void CComputerConfViewPrivate::initialize() { removeLayoutWidgets(); QWidget * ptrEmptyWidget = new QWidget; m_ptrGridLayout->addWidget(ptrEmptyWidget,0,0,ciHeaderRowCount,ciHeaderColCount); m_ptrGridLayout->setColumnMinimumWidth(0,25); m_ptrGridLayout->setRowMinimumHeight(0,25); }
void MainWindow::buildPoemList(int id) { removeLayoutWidgets(); if (otherContainer->layout()) delete otherContainer->layout(); poemLayout = new QVBoxLayout; poemLayout->setAlignment(Qt::AlignmentFlag::AlignTop); vector<PPoem> *data = dbIO->getPoems(id); { QPushButton *button; for (vector<PPoem>::const_iterator it = data->begin(); it < data->end(); it++) { button = new QPushButton(QString::fromStdString((*it)->title)); button->setUserData(Qt::UserRole + 1, (QObjectUserData *) (*it)); connect(button, &QPushButton::clicked, this, &MainWindow::onPoemClicked); poemLayout->addWidget(button); } } otherContainer->setLayout(poemLayout); }
void MainWindow::buildVerseList(int id) { removeLayoutWidgets(); if (otherContainer->layout()) delete otherContainer->layout(); tableLayout = new QGridLayout; tableLayout->setAlignment(Qt::AlignmentFlag::AlignTop); vector<PVerse> *data = dbIO->getVerses(id); QPushButton *next = new QPushButton("بعدی"), *prev = new QPushButton("قبلی"); tableLayout->addWidget(prev, 0, 0); tableLayout->addWidget(next, 0, 1); for (vector<PVerse>::const_iterator it = data->begin(); it < data->end(); it++) { QLabel *label = new QLabel(QString::fromStdString((*it)->text)); label->setAlignment(Qt::AlignmentFlag::AlignHCenter); tableLayout->addWidget(label, (*it)->vorder + 1, (*it)->position); } otherContainer->setLayout(tableLayout); }
MainWindow::~MainWindow() { removeLayoutWidgets(); }