Guest User

Untitled

a guest
Feb 16th, 2018
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. TileSetter::TileSetter(QWidget *parent) : QDialog(parent) {
  2.     ui.setupUi(this);
  3.     show();
  4.  
  5.     ui.flowlayout_placeholder_1->addLayout(selected_layout);
  6.  
  7.     for (int i = 0; i < 6; i++) {
  8.         QPushButton* button = new QPushButton;
  9.         button->setFixedSize(64, 64);
  10.         button->setIconSize({ 64, 64 });
  11.         button->setCheckable(true);
  12.  
  13.         selected_layout->addWidget(button);
  14.     }
  15.  
  16.     connect(ui.additionalAdd, &QPushButton::clicked, this, &TileSetter::add_tile);
  17. }
  18.  
  19. void TileSetter::add_tile() {
  20.     QPushButton* button = new QPushButton;
  21.     button->setFixedSize(64, 64);
  22.     button->setIconSize({ 64, 64 });
  23.     button->setCheckable(true);
  24.  
  25.     selected_layout->addWidget(button);
  26. }
  27. // This is the raw .ui file code
  28. // it is probably easier to create 1 button named additionalAdd and one layout named flowlayout_placeholder_1
  29.  
  30. //
  31. /********************************************************************************
  32. ** Form generated from reading UI file 'TileSetterwyEefc.ui'
  33. **
  34. ** Created by: Qt User Interface Compiler version 5.10.0
  35. **
  36. ** WARNING! All changes made in this file will be lost when recompiling UI file!
  37. ********************************************************************************/
  38.  
  39. #ifndef TILESETTERWYEEFC_H
  40. #define TILESETTERWYEEFC_H
  41.  
  42. #include <QtCore/QVariant>
  43. #include <QtWidgets/QAction>
  44. #include <QtWidgets/QApplication>
  45. #include <QtWidgets/QButtonGroup>
  46. #include <QtWidgets/QDialogButtonBox>
  47. #include <QtWidgets/QHBoxLayout>
  48. #include <QtWidgets/QHeaderView>
  49. #include <QtWidgets/QPushButton>
  50. #include <QtWidgets/QVBoxLayout>
  51. #include <QtWidgets/QWidget>
  52.  
  53. QT_BEGIN_NAMESPACE
  54.  
  55. class Ui_TileSetter
  56. {
  57. public:
  58.     QVBoxLayout *verticalLayout;
  59.     QHBoxLayout *flowlayout_placeholder_1;
  60.     QPushButton *additionalAdd;
  61.     QDialogButtonBox *buttonBox;
  62.  
  63.     void setupUi(QWidget *TileSetter)
  64.     {
  65.         if (TileSetter->objectName().isEmpty())
  66.             TileSetter->setObjectName(QStringLiteral("TileSetter"));
  67.         TileSetter->setWindowModality(Qt::WindowModal);
  68.         TileSetter->resize(579, 162);
  69.         QSizePolicy sizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
  70.         sizePolicy.setHorizontalStretch(0);
  71.         sizePolicy.setVerticalStretch(0);
  72.         sizePolicy.setHeightForWidth(TileSetter->sizePolicy().hasHeightForWidth());
  73.         TileSetter->setSizePolicy(sizePolicy);
  74.         TileSetter->setMinimumSize(QSize(0, 0));
  75.         verticalLayout = new QVBoxLayout(TileSetter);
  76.         verticalLayout->setSpacing(6);
  77.         verticalLayout->setContentsMargins(11, 11, 11, 11);
  78.         verticalLayout->setObjectName(QStringLiteral("verticalLayout"));
  79.         verticalLayout->setSizeConstraint(QLayout::SetDefaultConstraint);
  80.         flowlayout_placeholder_1 = new QHBoxLayout();
  81.         flowlayout_placeholder_1->setSpacing(6);
  82.         flowlayout_placeholder_1->setObjectName(QStringLiteral("flowlayout_placeholder_1"));
  83.         flowlayout_placeholder_1->setSizeConstraint(QLayout::SetDefaultConstraint);
  84.  
  85.         verticalLayout->addLayout(flowlayout_placeholder_1);
  86.  
  87.         additionalAdd = new QPushButton(TileSetter);
  88.         additionalAdd->setObjectName(QStringLiteral("additionalAdd"));
  89.  
  90.         verticalLayout->addWidget(additionalAdd);
  91.  
  92.         buttonBox = new QDialogButtonBox(TileSetter);
  93.         buttonBox->setObjectName(QStringLiteral("buttonBox"));
  94.         buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
  95.  
  96.         verticalLayout->addWidget(buttonBox);
  97.  
  98.  
  99.         retranslateUi(TileSetter);
  100.  
  101.         QMetaObject::connectSlotsByName(TileSetter);
  102.     } // setupUi
  103.  
  104.     void retranslateUi(QWidget *TileSetter)
  105.     {
  106.         TileSetter->setWindowTitle(QApplication::translate("TileSetter", "TileSetter", nullptr));
  107.         additionalAdd->setText(QApplication::translate("TileSetter", "PushButton", nullptr));
  108.     } // retranslateUi
  109.  
  110. };
  111.  
  112. namespace Ui {
  113.     class TileSetter: public Ui_TileSetter {};
  114. } // namespace Ui
  115.  
  116. QT_END_NAMESPACE
  117.  
  118. #endif // TILESETTERWYEEFC_H
Advertisement
Add Comment
Please, Sign In to add comment