juicy compiler error
This commit is contained in:
+35
-34
@@ -1,22 +1,23 @@
|
||||
#include "QWidget"
|
||||
#include "QList"
|
||||
#include "QLayout"
|
||||
#include "notebook.h"
|
||||
#include "notebooktab.h"
|
||||
#include "notebookpage.h"
|
||||
#include "notebookbutton.h"
|
||||
#include "QFormLayout"
|
||||
#include "QLayout"
|
||||
#include "QList"
|
||||
#include "QWidget"
|
||||
#include "colorscheme.h"
|
||||
#include "dialog.h"
|
||||
#include "notebookbutton.h"
|
||||
#include "notebookpage.h"
|
||||
#include "notebooktab.h"
|
||||
#include "settingsdialog.h"
|
||||
|
||||
Notebook::Notebook(QWidget *parent)
|
||||
: QWidget(parent),
|
||||
addButton(this),
|
||||
settingsButton(this),
|
||||
userButton(this)
|
||||
: QWidget(parent)
|
||||
, addButton(this)
|
||||
, settingsButton(this)
|
||||
, userButton(this)
|
||||
{
|
||||
connect(&settingsButton, SIGNAL(clicked()), this, SLOT(settingsButtonClicked()));
|
||||
connect(&settingsButton, SIGNAL(clicked()), this,
|
||||
SLOT(settingsButtonClicked()));
|
||||
|
||||
settingsButton.resize(24, 24);
|
||||
settingsButton.icon = NotebookButton::IconSettings;
|
||||
@@ -26,20 +27,21 @@ Notebook::Notebook(QWidget *parent)
|
||||
addButton.resize(24, 24);
|
||||
}
|
||||
|
||||
void Notebook::settingsButtonClicked()
|
||||
void
|
||||
Notebook::settingsButtonClicked()
|
||||
{
|
||||
SettingsDialog* a = new SettingsDialog();
|
||||
SettingsDialog *a = new SettingsDialog();
|
||||
|
||||
a->show();
|
||||
}
|
||||
|
||||
NotebookPage* Notebook::addPage()
|
||||
NotebookPage *
|
||||
Notebook::addPage()
|
||||
{
|
||||
auto tab = new NotebookTab(this);
|
||||
auto page = new NotebookPage(this, tab);
|
||||
|
||||
if (pages.count() == 0)
|
||||
{
|
||||
if (pages.count() == 0) {
|
||||
select(page);
|
||||
}
|
||||
|
||||
@@ -48,18 +50,18 @@ NotebookPage* Notebook::addPage()
|
||||
return page;
|
||||
}
|
||||
|
||||
void Notebook::select(NotebookPage* page)
|
||||
void
|
||||
Notebook::select(NotebookPage *page)
|
||||
{
|
||||
if (page == selected) return;
|
||||
if (page == selected)
|
||||
return;
|
||||
|
||||
if (page != nullptr)
|
||||
{
|
||||
if (page != nullptr) {
|
||||
page->setHidden(false);
|
||||
page->tab->setSelected(true);
|
||||
}
|
||||
|
||||
if (selected != nullptr)
|
||||
{
|
||||
if (selected != nullptr) {
|
||||
selected->setHidden(true);
|
||||
selected->tab->setSelected(false);
|
||||
}
|
||||
@@ -69,24 +71,23 @@ void Notebook::select(NotebookPage* page)
|
||||
performLayout();
|
||||
}
|
||||
|
||||
void Notebook::performLayout()
|
||||
void
|
||||
Notebook::performLayout()
|
||||
{
|
||||
int x = 48, y = 0;
|
||||
int tabHeight = 16;
|
||||
bool first = true;
|
||||
|
||||
for (auto &i : pages)
|
||||
{
|
||||
for (auto &i : pages) {
|
||||
tabHeight = i->tab->height();
|
||||
|
||||
if (!first && (i == pages.last() ? tabHeight : 0) + x + i->tab->width() > width())
|
||||
{
|
||||
y +=i->tab->height();
|
||||
if (!first &&
|
||||
(i == pages.last() ? tabHeight : 0) + x + i->tab->width() >
|
||||
width()) {
|
||||
y += i->tab->height();
|
||||
i->tab->move(0, y);
|
||||
x = i->tab->width();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
i->tab->move(x, y);
|
||||
x += i->tab->width();
|
||||
}
|
||||
@@ -96,14 +97,14 @@ void Notebook::performLayout()
|
||||
|
||||
this->addButton.move(x, y);
|
||||
|
||||
if (selected != nullptr)
|
||||
{
|
||||
if (selected != nullptr) {
|
||||
selected->move(0, y + tabHeight);
|
||||
selected->resize(width(), height() - y - tabHeight);
|
||||
}
|
||||
}
|
||||
|
||||
void Notebook::resizeEvent(QResizeEvent *)
|
||||
void
|
||||
Notebook::resizeEvent(QResizeEvent *)
|
||||
{
|
||||
performLayout();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user