当前位置: 首页>>代码示例>>C++>>正文


C++ QComboBox::setFixedWidth方法代码示例

本文整理汇总了C++中QComboBox::setFixedWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ QComboBox::setFixedWidth方法的具体用法?C++ QComboBox::setFixedWidth怎么用?C++ QComboBox::setFixedWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QComboBox的用法示例。


在下文中一共展示了QComboBox::setFixedWidth方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: slt_loadingStart

void JBlockerMainWindow::slt_loadingStart()
{
    this->statusBar()->showMessage(tr("LOADING MESSAGES ..."));
    // QMessageBox::information(this, QString(), QString("PROGRAM NEED TO LOAD MESSAGES"), QMessageBox::Ok);
    /* Create dialog */
    QDialog dialog;
    dialog.setWindowTitle(tr("Account Selection"));
    QHBoxLayout* layout = new QHBoxLayout();
    /* Label for dialog */
    QLabel* dialogLabel = new QLabel(tr("Select An Account:"));
    layout->addWidget(dialogLabel, 0, Qt::AlignHCenter);
    /* Combo box for selecting account */
    QComboBox* accountComboBox = new QComboBox();
    accountComboBox->setFixedWidth(280);
    /* Get account name list from message core */
    accountComboBox->addItems(p_messageCore->getAccountNameList());
    layout->addWidget(accountComboBox, 0, Qt::AlignHCenter);
    /* Button for dialog */
    QPushButton* dialogButton = new QPushButton(tr("Confirm"));
    layout->addWidget(dialogButton, 0, Qt::AlignHCenter);
    dialog.setLayout(layout);
    QObject::connect(dialogButton, SIGNAL(clicked()), &dialog, SLOT(accept()));
    dialog.exec();
    if(dialog.result())
    {
        /* Set selected account id */
        p_messageCore->setSelectedAccountId(accountComboBox->currentIndex());
    }

    this->statusBar()->addPermanentWidget(p_progressBar, 0);
    p_progressBar->setValue(0);
    p_progressBar->show();
    /* Core runs */
    p_messageCore->run();
}
开发者ID:biyu,项目名称:PlayGround,代码行数:35,代码来源:JBlockerMainWindow.cpp

示例2: QComboBox

QWidget *BackgroundAction::createWidget(QWidget *parent)
{
    QComboBox *comboBox = new QComboBox(parent);
    comboBox->setFixedWidth(42);

    for (int i = 0; i < colors().count(); ++i) {
        comboBox->addItem(tr(""));
        comboBox->setItemIcon(i, iconForColor((colors().at(i))));
    }

    comboBox->setCurrentIndex(0);
    connect(comboBox, SIGNAL(currentIndexChanged(int)), SLOT(emitBackgroundChanged(int)));

    comboBox->setProperty("hideborder", true);
    return comboBox;
}
开发者ID:DuinoDu,项目名称:qt-creator,代码行数:16,代码来源:backgroundaction.cpp

示例3: QWidget

KeyBinder::KeyBinder(QWidget * parent, const QString & helpText, const QString & defaultText, const QString & resetButtonText) : QWidget(parent)
{
    this->defaultText = defaultText;
    enableSignal = false;

    // Two-column tab layout
    QHBoxLayout * pageKeysLayout = new QHBoxLayout(this);
    pageKeysLayout->setSpacing(0);
    pageKeysLayout->setContentsMargins(0, 0, 0, 0);

    // Table for category list
    QVBoxLayout * catListContainer = new QVBoxLayout();
    catListContainer->setContentsMargins(10, 10, 10, 10);
    catList = new QListWidget();
    catList->setFixedWidth(180);
    catList->setStyleSheet("QListWidget::item { font-size: 14px; } QListWidget:hover { border-color: #F6CB1C; } QListWidget::item:selected { background: #150A61; color: yellow; }");
    catList->setFocusPolicy(Qt::NoFocus);
    connect(catList, SIGNAL(currentRowChanged(int)), this, SLOT(changeBindingsPage(int)));
    catListContainer->addWidget(catList);
    pageKeysLayout->addLayout(catListContainer);

    // Reset all binds button
    if (!resetButtonText.isEmpty())
    {
        QPushButton * btnResetAll = new QPushButton(resetButtonText);
        catListContainer->addWidget(btnResetAll);
        btnResetAll->setFixedHeight(40);
        catListContainer->setStretch(1, 0);
        catListContainer->setSpacing(10);
        connect(btnResetAll, SIGNAL(clicked()), this, SIGNAL(resetAllBinds()));
    }

    // Container for pages of key bindings
    QWidget * bindingsPagesContainer = new QWidget();
    QVBoxLayout * rightLayout = new QVBoxLayout(bindingsPagesContainer);

    // Scroll area for key bindings
    QScrollArea * scrollArea = new QScrollArea();
    scrollArea->setContentsMargins(0, 0, 0, 0);
    scrollArea->setWidget(bindingsPagesContainer);
    scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
    scrollArea->setWidgetResizable(true);
    scrollArea->setFrameShape(QFrame::NoFrame);
    scrollArea->setStyleSheet("background: #130F2A;");

    // Add key binding pages to bindings tab
    pageKeysLayout->addWidget(scrollArea);
    pageKeysLayout->setStretch(1, 1);

    // Custom help text
    QLabel * helpLabel = new QLabel();
    helpLabel->setText(helpText);
    helpLabel->setStyleSheet("color: #130F2A; background: #F6CB1C; border: solid 4px #F6CB1C; border-radius: 10px; padding: auto 20px;");
    helpLabel->setFixedHeight(24);
    rightLayout->addWidget(helpLabel, 0, Qt::AlignCenter);

    // Category list and bind table row heights
    const int rowHeight = 20;
    QSize catSize, headerSize;
    catSize.setHeight(36);
    headerSize.setHeight(24);

    // Category list header
    QListWidgetItem * catListHeader = new QListWidgetItem(tr("Category"));
    catListHeader->setSizeHint(headerSize);
    catListHeader->setFlags(Qt::NoItemFlags);
    catListHeader->setForeground(QBrush(QColor("#130F2A")));
    catListHeader->setBackground(QBrush(QColor("#F6CB1C")));
    catListHeader->setTextAlignment(Qt::AlignCenter);
    catList->addItem(catListHeader);

    // Populate
    bindingsPages = new QHBoxLayout();
    bindingsPages->setContentsMargins(0, 0, 0, 0);
    rightLayout->addLayout(bindingsPages);
    QWidget * curPage = NULL;
    QVBoxLayout * curLayout = NULL;
    QTableWidget * curTable = NULL;
    bool bFirstPage = true;
    selectedBindTable = NULL;
    bindComboBoxCellMappings = new QHash<QObject *, QTableWidgetItem *>();
    bindCellComboBoxMappings = new QHash<QTableWidgetItem *, QComboBox *>();
    for (int i = 0; i < BINDS_NUMBER; i++)
    {
        if (cbinds[i].category != NULL)
        {
            // Add stretch at end of previous layout
            if (curLayout != NULL) curLayout->insertStretch(-1, 1);

            // Category list item
            QListWidgetItem * catItem = new QListWidgetItem(HWApplication::translate("binds (categories)", cbinds[i].category));
            catItem->setSizeHint(catSize);
            catList->addItem(catItem);

            // Create new page
            curPage = new QWidget();
            curLayout = new QVBoxLayout(curPage);
            curLayout->setSpacing(2);
            bindingsPages->addWidget(curPage);
            if (!bFirstPage) curPage->setVisible(false);
//.........这里部分代码省略.........
开发者ID:RobWatlingSF,项目名称:hedgewars,代码行数:101,代码来源:keybinder.cpp

示例4: createToolBar


//.........这里部分代码省略.........

    //Horizontal alignment
    action = new QAction(findIcon("tool-align-horz.png"), tr("Horizontal alignment"), mToolBar);
    action->setCheckable(false);
    action->setShortcut(QKeySequence(tr("8", "Horizontal alignment")));
    alignButton->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(onHorizontalAlignment()));

    // Energy-based layout
    action = new QAction(findIcon("tool-align-energy.png"), tr("Energy-based layout"), mToolBar);
    action->setCheckable(false);
    action->setShortcut(QKeySequence(tr("9", "Energy-based layout")));
    alignButton->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(onEnergyBasedLayout()));


    // selection group button
    QToolButton *selectButton = new QToolButton(mToolBar);
    selectButton->setIcon(findIcon("tool-select-group.png"));
    selectButton->setPopupMode(QToolButton::InstantPopup);
    mToolBar->addWidget(selectButton);

    // input/output selection
    action = new QAction(findIcon("tool-select-inout.png"), tr("Select input/output"), mToolBar);
    action->setCheckable(false);
    selectButton->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(onSelectInputOutput()));

    // sbgraph selection
    action = new QAction(findIcon("tool-select-subgraph.png"), tr("Select subgraph"), mToolBar);
    action->setCheckable(false);
    selectButton->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(onSelectSubgraph()));

    mToolBar->addSeparator();

    action = new QAction(findIcon("tool-export-image.png"), tr("Export image"), mToolBar);
    action->setCheckable(false);
    action->setShortcut(QKeySequence(tr("0", "Export image")));
    mToolBar->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(onExportImage()));

    action = new QAction(findIcon("tool-print.png"), tr("Print"), mToolBar);
    action->setCheckable(false);
    action->setShortcut(QKeySequence(tr("0", "Print")));
    mToolBar->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(onPrint()));

    //
    mToolBar->addSeparator();
    //Scale combobox
    QComboBox* b = new QComboBox(mToolBar);
    b->setFixedWidth(55);
    b->setEditable(true);
    b->setInsertPolicy(QComboBox::NoInsert);
    b->addItems(SCgWindow::mScales);
    b->setCurrentIndex(mScales.indexOf("100"));
    mZoomFactorLine = b->lineEdit();
    mZoomFactorLine->setInputMask("D90%");
    mToolBar->addWidget(b);
    connect(mZoomFactorLine, SIGNAL(textChanged(const QString&)), mView, SLOT(setScale(const QString&)));
    connect(mView, SIGNAL(scaleChanged(qreal)), this, SLOT(onViewScaleChanged(qreal)));
    //
    //Zoom in
    //action = new QAction(findIcon("tool-zoom-in.png"), tr("Zoom in"), mToolBar);
    action = new QAction("+",mToolBar);
    action->setToolTip(tr("Zoom in"));
    action->setCheckable(false);
    action->setShortcut(QKeySequence(tr("+", "Zoom in")));
    mToolBar->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(onZoomIn()));

    //slider scale
    mZoomSlider = new QSlider();
    mZoomSlider->setFixedWidth(40);
    mZoomSlider->setSizeIncrement(25,180/25);
    mZoomSlider->setFixedHeight(180);
    mZoomSlider->setToolTip(tr("Scale"));
    mZoomSlider->setMinimum(mZoomSliderMinValue);
    mZoomSlider->setValue(100);
    mZoomSlider->setMaximum(mZoomSliderMaxValue);
    mToolBar->addWidget(mZoomSlider);
    connect(mZoomSlider,SIGNAL(valueChanged(int)),this,SLOT(onmZoomSliderMove(int)));


    //Zoom out
  //  action = new QAction(findIcon("tool-zoom-out.png"), tr("Zoom out"), mToolBar);
    action = new QAction("-", mToolBar);
    action->setToolTip(tr("Zoom out"));
    action->setCheckable(false);
    action->setShortcut(QKeySequence(tr("-", "Zoom out")));
    mToolBar->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(onZoomOut()));

    mToolBar->setWindowTitle(tr("SCg Tools"));
    mToolBar->setObjectName("SCgMainToolBar");

    //! @bug toolbar state is not saved
    mToolBar->setMovable(false);
}
开发者ID:maxzh-voronets,项目名称:kbe,代码行数:101,代码来源:scgwindow.cpp

示例5: QLabel

QBoxLayout *
View::focusPanelLayout()
{
    /*
     *  Focus mode when not in live view.
     */
    QLabel *focusModeLabel = new QLabel( tr("Focus mode:") );
    focusMode = new FocusMode();
    focusMode->setStatusTip( tr("Focus mode when not in live view") );
    QObject::connect(
	focusMode, SIGNAL(propertyChanged(int,int)),
	this, SIGNAL(propertyChanged(int,int)));

    /*
     *  Focus mode when in live view.
     */
    QLabel *focusModeLiveLabel = new QLabel( tr("Live view:") );
    focusModeLive = new QComboBox();
    focusModeLive->setMaxCount( Map::MAX_FocusMode );
    focusModeLive->setStatusTip( tr("Focus mode when in live view") );
    focusModeLive->setFixedWidth( 80 );
    setEvfAFList( camera );
    QObject::connect(
	focusModeLive, SIGNAL(activated(int)),
	this, SLOT(toEvfAFValue(int)) );

    /*
     *  Auto focus button.
     */
    QLabel *focusLabel = new QLabel( tr("Focus:  ") );
    QToolButton *focusButton = new QToolButton();
    focusButton->setAutoRaise( true );
    focusButton->setIcon( QIcon(":/Resources/Misc/button.png") );
    focusButton->setIconSize( QSize(22, 22) );
    focusButton->setStatusTip( tr("Auto focus") );
    QObject::connect(
	focusButton, SIGNAL(pressed()),
	this, SLOT(autoFocusInitiated()) );
    QObject::connect(
	focusButton, SIGNAL(released()),
	this, SLOT(autoFocusDiscontinued()) );

    /*
     *  Focus map to show on live view.
     */
    QLabel *focusMapLabel = new QLabel( tr("Focus map:") );
    QComboBox *focusMapComboBox = new QComboBox();
    focusMapComboBox->setStatusTip( tr("Capture series of images for constructing focus map") );
    focusMapComboBox->addItem( tr("Disabled") );
    focusMapComboBox->addItem( tr("Enabled") );
    focusMapComboBox->setFixedWidth( 80 );
    focusMapComboBox->setCurrentIndex( 0 );
    camera->setFocusMapSetting( 0 );
    QObject::connect(
	focusMapComboBox, SIGNAL(activated(int)),
	this, SLOT(setFocusMap(int)) );

    /*
     *  Depth of field (DOF) preview.
     */
    QLabel *dofPreviewLabel = new QLabel( tr("DOF preview:") );
    QComboBox *dofPreviewComboBox = new QComboBox();
    dofPreviewComboBox->addItem( tr("Disabled") );
    dofPreviewComboBox->addItem( tr("Enabled") );
    dofPreviewComboBox->setFixedWidth( 80 );
    dofPreviewComboBox->setCurrentIndex( 0 );
    QObject::connect(
	dofPreviewComboBox, SIGNAL(activated(int)),
	this, SLOT(setDOFPreview(int)) );

    /*
     *  Focus adjustment buttons.
     */
    const bool flat = false;
    const int width = 22;
    const int height = 16;
    const int buttonHeight = 23;
    const int latency = 333;
    QLabel *focusAdjustmentLabel = new QLabel();
    focusAdjustmentLabel->setText( tr("Focus adjustment:") );

    /*
     *  Near focus: <<<
     */
    QPushButton *focusNear3Button = new QPushButton();
    focusNear3Button->setStatusTip( tr("Near focus: large movement") );
    focusNear3Button->setIcon( QIcon(":/Resources/Focus/arrow-left3.png") );
    focusNear3Button->setIconSize( QSize(width, height) );
    focusNear3Button->setFixedHeight( buttonHeight );
    focusNear3Button->setFlat( flat );
    focusNear3Button->setAutoRepeat( true );
    focusNear3Button->setAutoRepeatDelay( latency );
    focusNear3Button->setAutoRepeatInterval( latency );

    /*
     *  Near focus: <<
     */
    QPushButton *focusNear2Button = new QPushButton();
    focusNear2Button->setStatusTip( tr("Near focus: medium movement") );
    focusNear2Button->setIcon( QIcon(":/Resources/Focus/arrow-left2.png") );
//.........这里部分代码省略.........
开发者ID:rudi-c,项目名称:computational-photography-research,代码行数:101,代码来源:focus.cpp

示例6: QWidget

MatchWindow::MatchWindow () :
	closed (false)
{
	centralWidget = new QWidget (this);
	this->setCentralWidget(centralWidget);

	mainLayout = new QVBoxLayout (centralWidget);
	centralWidget->setLayout (mainLayout);

	imagesContainer = new QWidget (centralWidget);
	imagesContainer->setLayout (new QHBoxLayout());
	mainLayout->addWidget (imagesContainer);

	glcanvas = new RenderWidget (MatchWindow::defaultImageWidth, MatchWindow::defaultImageHeight, centralWidget);

	imageDisplay = new ImageDisplay (
		QSize(MatchWindow::defaultImageWidth, MatchWindow::defaultImageHeight),
		glcanvas,
		centralWidget);
	imagesContainer->layout()->addWidget (imageDisplay);

	vmap = new VectorMap ();
	vmap->loadAll (VECTOR_MAP_PATH);

	// glcanvas must be added in widget hierarchy
	imagesContainer->layout()->addWidget (glcanvas);
	insertObjects (glcanvas, vmap);

	/* Poor man's toolbar */
	QWidget *btnBar = new QWidget (centralWidget);
	btnBar->setLayout(new QHBoxLayout());
	centralWidget->layout()->addWidget(btnBar);

	QPushButton *captureBtn = new QPushButton ("Capture", centralWidget);
	captureBtn->setFixedWidth(120);
	btnBar->layout()->addWidget(captureBtn);
	QObject::connect (captureBtn, SIGNAL(clicked()), this, SLOT(captureClicked()));

	QPushButton *searchBtn = new QPushButton ("Search", centralWidget);
	searchBtn->setFixedWidth(120);
	btnBar->layout()->addWidget(searchBtn);
	QObject::connect (searchBtn, SIGNAL(clicked()), this, SLOT(searchButtonClicked()));

	QPushButton *resetBtn = new QPushButton ("Reset", centralWidget);
	resetBtn->setFixedWidth(120);
	btnBar->layout()->addWidget(resetBtn);
	QObject::connect (resetBtn, SIGNAL(clicked()), this, SLOT(resetButtonClicked()));

	QComboBox *imageTypeSelector = new QComboBox (centralWidget);
	imageTypeSelector->setFixedWidth(210);
	imageTypeSelector->insertItem(ImageDisplay::ImageTypeRgb, "RGB");
	imageTypeSelector->insertItem(ImageDisplay::ImageTypeGray, "Grayscale");
	imageTypeSelector->insertItem(ImageDisplay::ImageTypeGrayProcessed, "Processed Grayscale");
	QObject::connect (imageTypeSelector, SIGNAL(currentIndexChanged(int)), imageDisplay, SLOT(changeImageType(int)));
	btnBar->layout()->addWidget(imageTypeSelector);

	QCheckBox *toggleMap = new QCheckBox ("Show Map", centralWidget);
	QObject::connect (toggleMap, SIGNAL(toggled(bool)), imageDisplay, SLOT(toggleMapProjection(bool)));
	toggleMap->setChecked(true);
	btnBar->layout()->addWidget (toggleMap);

	QWidget *poseBox = new QWidget (centralWidget);
	poseBox->setLayout(new QHBoxLayout());
	mainLayout->addWidget(poseBox);

	QWidget *posContainer = new QWidget (centralWidget);
	posContainer->setLayout(new QVBoxLayout());
	posContainer->layout()->addWidget(new QLabel("Position"));
	posContainer->layout()->addWidget(wposx = new LabelWithTextBox("X"));
	posContainer->layout()->addWidget(wposy = new LabelWithTextBox("Y"));
	posContainer->layout()->addWidget(wposz = new LabelWithTextBox("Z"));
	QObject::connect (wposx, SIGNAL(doPoseChange(QString,int)),
		this, SLOT(PoseChangeManual(QString,int)));
	QObject::connect (wposy, SIGNAL(doPoseChange(QString,int)),
		this, SLOT(PoseChangeManual(QString,int)));
	QObject::connect (wposz, SIGNAL(doPoseChange(QString,int)),
		this, SLOT(PoseChangeManual(QString,int)));

	QWidget *oriContainer = new QWidget (centralWidget);
	oriContainer->setLayout (new QVBoxLayout());
	oriContainer->layout()->addWidget(new QLabel("Orientation"));
	oriContainer->layout()->addWidget(wroll = new LabelWithTextBox("Bank"));
	oriContainer->layout()->addWidget(wpitch = new LabelWithTextBox("Elevation"));
	oriContainer->layout()->addWidget(wyaw = new LabelWithTextBox("Heading"));
	QObject::connect (wroll, SIGNAL(doPoseChange(QString,int)),
		this, SLOT(PoseChangeManual(QString,int)));
	QObject::connect (wpitch, SIGNAL(doPoseChange(QString,int)),
		this, SLOT(PoseChangeManual(QString,int)));
	QObject::connect (wyaw, SIGNAL(doPoseChange(QString,int)),
		this, SLOT(PoseChangeManual(QString,int)));

	poseBox->layout()->addWidget(posContainer);
	poseBox->layout()->addWidget(oriContainer);

	cameraFix = new PointSolver (vmap, glcanvas, MatchWindow::defaultImageWidth, MatchWindow::defaultImageHeight);

	return;
}
开发者ID:sujiwo,项目名称:vector-map-localization,代码行数:98,代码来源:MatchWindow.cpp


注:本文中的QComboBox::setFixedWidth方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。