Exemple #1
0
void MainWindow::addNewItem()
{
    // copied from ui_itemFrame.h
    QHBoxLayout *itemLayout = new QHBoxLayout();
    itemLayout->setObjectName(QString::fromUtf8("itemLayout"));
    itemLayout->setSizeConstraint(QLayout::SetFixedSize);
    QCheckBox *haveFoundCheckBox = new QCheckBox();
    haveFoundCheckBox->setObjectName(QString::fromUtf8("haveFoundCheckBox"));
    haveFoundCheckBox->setMinimumHeight(30);

    itemLayout->addWidget(haveFoundCheckBox);

    QLineEdit *amountBox = new QLineEdit();
    amountBox->setObjectName(QString::fromUtf8("amountBox"));
    amountBox->setMaximumSize(QSize(80, 16777215));
    amountBox->setMinimumHeight(38);
    amountBox->setMinimumWidth(100);

    itemLayout->addWidget(amountBox);

    QLineEdit *itemName = new QLineEdit();
    itemName->setObjectName(QString::fromUtf8("itemName"));
    itemName->setMinimumHeight(38);
    itemName->setMinimumWidth(300);

    itemLayout->addWidget(itemName);

    QSpacerItem *horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);

    itemLayout->addItem(horizontalSpacer);

    QPushButton *deleteButton = new QPushButton();
    deleteButton->setObjectName(QString::fromUtf8("deleteButton"));
    deleteButton->setText("Remove");
    deleteButton->setMinimumHeight(38);
    //deleteButton->setCenterButtons(false);

    itemLayout->addWidget(deleteButton);
    // end of copied from ui_itemFrame.h
    // Doesn't work atm?
    //QObject::connect(deleteButton, SIGNAL(clicked(QAbstractButton*)), haveFoundCheckBox, SLOT(deleteLater()));
    QObject::connect(deleteButton, SIGNAL(clicked()), amountBox, SLOT(deleteLater()));
    QObject::connect(deleteButton, SIGNAL(clicked()), itemName, SLOT(deleteLater()));
    QObject::connect(deleteButton, SIGNAL(clicked()), deleteButton, SLOT(deleteLater()));
    QObject::connect(deleteButton, SIGNAL(clicked()), haveFoundCheckBox, SLOT(deleteLater()));
    QObject::connect(deleteButton, SIGNAL(clicked()), itemLayout, SLOT(deleteLater()));
    QObject::connect(deleteButton, SIGNAL(clicked()), this,SLOT(itemWasRemoved()));
    ui->mainLayout->addLayout(itemLayout);
    widgetsize+=80; // in principle should also reduce when removing item, need to create a slot...
    ui->scrollAreaContents->setFixedHeight(widgetsize);
}
Exemple #2
0
// Create new checkbox widget
QtWidgetObject* AtenTreeGuiDialog::addCheck(TreeGuiWidget* widget, QString label)
{
	QtWidgetObject* qtwo = widgetObjects_.add();
	QCheckBox *check = new QCheckBox(this);
	qtwo->set(widget, check);
	check->setText(label);
	check->setChecked(widget->valueI());
	check->setEnabled(widget->enabled());
	check->setVisible(widget->visible());
	check->setMinimumHeight(WIDGETHEIGHT);
	check->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
	// Connect signal to master slot
	QObject::connect(check, SIGNAL(clicked(bool)), this, SLOT(checkBoxWidget_clicked(bool)));
	return qtwo;
}
Exemple #3
0
void OpenDistant::init() {
    idRecipeToOpen = -1;
    ui->categoriesBox->setContentsMargins(0,10,0,0);
    /*ui->categoriesBox->setMinimumHeight(70);*/
    QVBoxLayout *catLay = new QVBoxLayout(ui->scrollCatsContent);
    catLay->setMargin(0);
    catLay->setContentsMargins(0,10,0,0);
    catLay->setSpacing(2);
    foreach (QString cat, namesCats) {
        QCheckBox *catI = new QCheckBox(cat);
        catI->setMaximumHeight(21);
        catI->setMinimumHeight(21);
        catLay->addWidget(catI);
        cboxes.append(catI);
        connect(catI, SIGNAL(stateChanged(int)), this, SLOT(stateChanged()));;
    }
Exemple #4
0
void OsgForm::buildLayerBox()
{
    QGridLayout *grid = new QGridLayout(ui->layerFrame);
    for (int row=0 ; row < numRowsOfLayerButtons ; row++) {
        for (int col=0 ; col < numColsOfLayerButtons ; col++) {
            QCheckBox * cb = new QCheckBox(ui->layerFrame);
            cb->setCheckable(true);
            cb->setChecked(false);
            cb->setMinimumWidth(12);
            cb->setMinimumHeight(16);
            grid->addWidget(cb, row, (numColsOfLayerButtons-1)-col);
            connect(cb, SIGNAL(stateChanged(int)),
                    this, SLOT(tweakCameraMaskBit(int)));
            m_checkBoxes.append(cb);
        }
    }
    grid->setHorizontalSpacing(0);
    grid->setVerticalSpacing(0);
    grid->setContentsMargins(0,0,0,0);
}