コード例 #1
0
void TestQScrollArea1F::createWidget()
{
	resize(300, 360);

	QGridLayout* gridLayout = new QGridLayout(this);
	QScrollArea* scrollArea = new QScrollArea(this);
	//scrollArea->setWidgetResizable(false);
	//scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);

	QWidget* scrollAreaWidgetContents = new QWidget();
	//scrollAreaWidgetContents->setGeometry(QRect(0, 0, 380, 251));
	scrollArea->setWidget(scrollAreaWidgetContents);

	gridLayout->addWidget(scrollArea, 0, 0, 1, 2);

	QSpacerItem* horizontalSpacer = new QSpacerItem(298, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
	gridLayout->addItem(horizontalSpacer, 1, 0, 1, 1);

	QPushButton* pushButton = new QPushButton(this);
	pushButton->setText("OK");
	gridLayout->addWidget(pushButton, 1, 1, 1, 1);

	QWidget* content = new QWidget();
	content->setMinimumHeight(280);
	//content->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed);

	QVBoxLayout* vlayout = new QVBoxLayout(content);
	//scrollArea->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
	vlayout->addWidget(createGroupBox("box1", 3));
	vlayout->addWidget(createGroupBox("box2", 5));
	vlayout->addStretch(1);

	scrollArea->setWidget(content);
	//scrollArea->setFixedHeight(420);
}
コード例 #2
0
void MyScrollAreaWidget::test2f()
{
	QWidget* content = new QWidget();
	content->setMinimumHeight(280);
	//content->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed);

	QVBoxLayout* vlayout = new QVBoxLayout(content);
	//scrollArea->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
	vlayout->addWidget(createGroupBox("box1", 3));
	vlayout->addWidget(createGroupBox("box2", 5));
	vlayout->addStretch(1);

	this->setWidget(content);
}
コード例 #3
0
ファイル: mainwindow.cpp プロジェクト: CodeDJ/qt5-hidpi
MainWindow::MainWindow()
{
    centralWidget = new QWidget;
    setCentralWidget(centralWidget);

    createGroupBox();

    listWidget = new QListWidget;
    for (int i = 0; listEntries[i]; ++i)
        listWidget->addItem(tr(listEntries[i]));

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addWidget(groupBox);
    mainLayout->addWidget(listWidget);
    centralWidget->setLayout(mainLayout);

    exitAction = new QAction(tr("E&xit"), this);
    connect(exitAction, SIGNAL(triggered()), qApp, SLOT(quit()));

    fileMenu = menuBar()->addMenu(tr("&File"));
    fileMenu->setPalette(QPalette(Qt::red));
    fileMenu->addAction(exitAction);

    setWindowTitle(tr("Language: %1").arg(tr("English")));
    statusBar()->showMessage(tr("Internationalization Example"));

    if (tr("LTR") == "RTL")
        setLayoutDirection(Qt::RightToLeft);
}
コード例 #4
0
ファイル: demo_dialog.cpp プロジェクト: latture/tresta
    DemoDialog::DemoDialog(QWidget *parent) : saveDirectory(QDir::currentPath()), defaultFilePrefix("frame") {
        setModal(true);
        setMinimumWidth(400);
        setMinimumHeight(200);

        QVBoxLayout *layout = new QVBoxLayout();
        createGroupBox();
        layout->addWidget(groupBox);
        setLayout(layout);
    }
コード例 #5
0
ファイル: general_window.cpp プロジェクト: Almamu/crashutils
LRESULT general_window::onCreate(UINT uMsg, WPARAM wParam, LPARAM lParam)
{                        
  createGroupBox(0, 20,  10, 360, 165, "Properties");
  
  createText(0, 30, 32, 120, 12, "Location: ");
  createText(0, 30, 62, 120, 12, "Dimensions: ");
  
  raw_group_createparams params = {   3,  1, 
                                    IDC_EDITLOCATIONX, 
                                    180, 30, 60, 20,
                                      2,  2, 2,  2,
                                      0,  0 };
                                    
  raw_control::createGroup(location, params, hSelf);
  for (int lp=0; lp<3; lp++)
    location[lp]->addSpin(IDC_SPINLOCATIONX+lp, -100000, 100000);

  params.baseID = IDC_EDITDIMENSIONW;
  params.y      = 60;
  
  raw_control::createGroup(dimension, params, hSelf);
  for (int lp=0; lp<3; lp++)
    dimension[lp]->addSpin(IDC_SPINDIMENSIONW+lp, 0, 10000);

  
  checks[0] = new check(  IDC_CHECKBOTTOMSOLID, 30, 95, 320, 12, hSelf,
                        "Bottom of zone != solid ground (causes death if fallen below)");
  checks[1] = new check(     IDC_CHECKTOPSOLID, 30, 110, 320, 12, hSelf,
                        "Top of zone = solid ceiling (top of zone = top of level)");
  checks[2] = new check(IDC_CHECKCONTAINSWATER, 30, 125, 320, 12, hSelf,
                        "Contains water (can cause drowning type death)");
  checks[3] = new check( IDC_CHECKNOSOLIDWALLS, 30, 140, 320, 12, hSelf, 
                        "Does not contain solid walls");
  checks[4] = new check(IDC_CHECKNOCHECKPOINTS, 30, 155, 320, 12, hSelf,
                        "Does not save checkpoint state");

  createGroupBox(0, 20, 180, 360, 160, "Statistics");


  return NULL;
}
コード例 #6
0
ファイル: scopeviewform.cpp プロジェクト: JimmyGong/learngit
void ScopeviewForm::loadData()
{
    //暂时
    _graphView->scene()->clear();
    _groupboxs.clear();

    for (int i = 0; i < 8; ++i)
    {
        QGroupBox* gbox = createGroupBox(i + 1);
        _groupboxs.append(gbox);

        _graphView->scene()->addWidget(gbox);
    }

    updateSceneRect();
    updateSceneItemPos();
}
コード例 #7
0
MainWindow::MainWindow()
{
    createGroupBox();
    createActions();
    createTrayIcon();
    setIcon();

    connect(programDeviceButton, SIGNAL(clicked()), this, SLOT(programDevice()));
    connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
            this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));

    QHBoxLayout *mainLayout = new QHBoxLayout;
    mainLayout->addWidget(groupBox);
    setLayout(mainLayout);
    trayIcon->show();

    setWindowTitle(tr("Systraymouse"));
    setFixedSize(250,200);

    stm32=new Device();
}