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


C++ QLabel::setMinimumWidth方法代码示例

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


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

示例1: QWidget

    ConnectionTab::ConnectionTab(QWidget *parent)
        : QWidget(parent)
    {
        const short int labelWidth = 120;

        QLabel* bandwidthLabel = new QLabel(tr("Bandwidth limit [kB]:"));
        bandwidthLabel->setMinimumWidth(labelWidth);
        QLineEdit* bandwidthEdit = new QLineEdit("0");
        QHBoxLayout* bandwidthLayout = new QHBoxLayout;
        bandwidthLayout->addWidget(bandwidthLabel);
        bandwidthLayout->addWidget(bandwidthEdit);
        bandwidthLayout->addWidget(new QLabel("(0 - unlimited)"));
        bandwidthLayout->addStretch(1);

        QLabel* downloadsLabel = new QLabel(tr("Simultanious downloads:"));
        downloadsLabel->setMinimumWidth(labelWidth);
        m_pDownloadsSpin = new QSpinBox; 
        m_pDownloadsSpin->setRange(1,999);
        int v = Proxy::settings()->value( SettingsValNames::scMaxDownloads,Settings::LIBRARY).value<int>() ;
        m_pDownloadsSpin->setValue ( v==0 ? 2 : v );
        m_pDownloadsSpin->setMaximumWidth(45);
        QHBoxLayout* downloadsLayout = new QHBoxLayout;
        downloadsLayout->addWidget(downloadsLabel);
        downloadsLayout->addWidget( m_pDownloadsSpin );
        downloadsLayout->addStretch(1);

        QVBoxLayout* layout = new QVBoxLayout;
        layout->addSpacing(settings_ui::SpaceBeforeFirstWidget);
        layout->addLayout(bandwidthLayout);
        layout->addSpacing(settings_ui::SpaceBeetwenWidgets);
        layout->addLayout(downloadsLayout);
        layout->addStretch(1);

        setLayout(layout);
    }
开发者ID:algometrix,项目名称:QRapidshare,代码行数:35,代码来源:connectionsettingspage.cpp

示例2: initialize

void SearchControl::initialize()
{
	QHBoxLayout * layoutSearch = new QHBoxLayout();
	QVBoxLayout * layout = new QVBoxLayout();
	QHBoxLayout * layoutTracks = new QHBoxLayout();
	QHBoxLayout * layoutAnnotations = new QHBoxLayout();
	
	QPushButton * clearButton = new QPushButton("Clear");
	QCheckBox * caseCheckBox = new QCheckBox("Match case");
	lineEdit = new QLineEdit();
	labelResultsTracks = new StatusLabel();
	labelResultsAnnotations = new StatusLabel();
	
	QLabel * labelTracks = new QLabel(tr("tracks"));
	QLabel * labelAnnotations = new QLabel(tr("annotations"));
	
	labelResultsAnnotations->setMinimumWidth(100);
	labelResultsAnnotations->setMaximumWidth(100);
	labelAnnotations->setMinimumWidth(100);
	labelAnnotations->setMaximumWidth(100);
	labelResultsTracks->setMinimumWidth(100);
	labelResultsTracks->setMaximumWidth(100);
	labelTracks->setMinimumWidth(100);
	labelTracks->setMaximumWidth(100);
	labelResultsTracks->setMinimumHeight(19);
	labelResultsAnnotations->setMinimumHeight(19);
	
	layoutSearch->addWidget(lineEdit);
	layoutSearch->addWidget(clearButton);
	layout->addLayout(layoutSearch);
	layout->addWidget(caseCheckBox);
	layoutTracks->addWidget(labelResultsTracks);
	layoutTracks->addWidget(labelTracks);
	layoutTracks->setAlignment(Qt::AlignLeft);
	layoutAnnotations->addWidget(labelResultsAnnotations);
	layoutAnnotations->addWidget(labelAnnotations);
	layoutAnnotations->setAlignment(Qt::AlignLeft);
	layout->addLayout(layoutTracks);
	layout->addLayout(layoutAnnotations);
	
	qDeleteAll(children());
	delete this->layout();
	setLayout(layout);
	
	connect(lineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(textChanged(const QString &)));
	connect(clearButton, SIGNAL(clicked()), this, SLOT(clear()));
	connect(caseCheckBox, SIGNAL(stateChanged(int)), this, SLOT(matchCaseChaged(int)));
	
	matchCase = false;
	setWindowTitle("Find");
	adjustSize();
}
开发者ID:marbl,项目名称:gingr,代码行数:52,代码来源:SearchControl.cpp

示例3: QLabel

QLabel * TASARIM_DESIGN_WIDGET::CREATE_NEW_LABEL ( const QString &text, QWidget * parent )
{
    if ( parent EQ NULL ) {
        parent = this;
    }

    QLabel * label = new QLabel(text.toUtf8(),parent);
    label->setMargin(0);
    label->setIndent(0);
    QFont label_font = label->font();
    label_font.setFixedPitch    ( false );
    label_font.setKerning       ( false );
    label_font.setLetterSpacing ( QFont::AbsoluteSpacing, 0.01 );
    label_font.setWordSpacing   ( 0.01 );
    label->setScaledContents    ( true );
    label->setFont              ( label_font );
    label->setFocusPolicy       ( Qt::StrongFocus );

    int width = label->width();
    label->setMinimumWidth( width + 5 );

    label->installEventFilter( this );

    SET_LABEL_FONTS_UNSELECTED( label );

    return label;
}
开发者ID:coolixwebgraphics,项目名称:FRAMEWORK,代码行数:27,代码来源:tasarim_design_widget.cpp

示例4: setupGui

void ProgressDialog::setupGui(const QString& heading)
{
    QVBox* vbox = makeVBoxMainWidget();
    vbox->setSpacing(10);

    QWidget* headingBox = new QWidget(vbox);
    QHBoxLayout* hboxLayout = new QHBoxLayout(headingBox);

    QLabel* textLabel = new QLabel(heading, headingBox);
    textLabel->setMinimumWidth(textLabel->sizeHint().width());
    textLabel->setFixedHeight(textLabel->sizeHint().height());
    hboxLayout->addWidget(textLabel);
    hboxLayout->addStretch();

    d->gear = new KAnimWidget(QString("kde"), 32, headingBox);
    d->gear->setFixedSize(32, 32);
    hboxLayout->addWidget(d->gear);

    d->resultbox = new QListBox(vbox);
    d->resultbox->setSelectionMode(QListBox::NoSelection);
    QFontMetrics fm(d->resultbox->fontMetrics());
    d->resultbox->setMinimumSize(fm.width("0")*70, fm.lineSpacing()*8);

    resize(sizeHint());
}
开发者ID:serghei,项目名称:kde-kdesdk,代码行数:25,代码来源:progressdlg.cpp

示例5: EdLevelSoundThumbnail

EdLevelResourceSound::EdLevelResourceSound (const FilePath &path)
{
    
    EdLevelSoundThumbnail *item = new EdLevelSoundThumbnail(this);
    item->setSound(path);
    item->setMaximumWidth(128);
    item->setMinimumWidth(128);
    item->setMaximumHeight(128);
    item->setMinimumHeight(128);

    QLabel *title = new QLabel(this);
    title->setMaximumWidth(200);
    title->setMinimumWidth(200);
    title->setText(path.file_name().c_str());
    
    QGridLayout *layout = new QGridLayout;
    layout->setContentsMargins(2,2,2,2);
    layout->setHorizontalSpacing(0);
    layout->setVerticalSpacing(0);
    layout->setColumnStretch(1,1);
    layout->addWidget(item,1,0);
    layout->addWidget(title,0,0);

    setLayout(layout);
    
    setMinimumHeight(15+2+128);
    setMinimumWidth(200);
    setMaximumWidth(200);
}
开发者ID:9heart,项目名称:DT3,代码行数:29,代码来源:EdLevelResourceSound.cpp

示例6: AddDouble

void ParamWidget::AddDouble(const QString& name,
    double min, double max, double step, double initial_value,
    DisplayHint display_hint) {
  ExpectNameNotFound(name);

  if (display_hint == DisplayHint::kSpinBox) {
    QDoubleSpinBox* spinbox = new QDoubleSpinBox(this);
    spinbox->setRange(min, max);
    spinbox->setSingleStep(step);
    spinbox->setValue(initial_value);
    spinbox->setProperty("param_widget_type", kParamDouble);
    widgets_[name] = spinbox;
    AddLabeledRow(name, spinbox);
    connect(spinbox,
        static_cast<void(QDoubleSpinBox::*)(double)>(
          &QDoubleSpinBox::valueChanged),
        [this, name](double value) {
          emit ParamChanged(name);
        });
  } else if (display_hint == DisplayHint::kSlider) {
    QWidget* row_widget = new QWidget(this);
    QHBoxLayout* row_hbox = new QHBoxLayout(row_widget);
    QSlider* slider = new QSlider(Qt::Horizontal, this);
    const int num_steps = static_cast<int>((max - min) / step);
    const int initial_value_int =
      static_cast<int>((initial_value - min) / step);
    slider->setRange(0, num_steps);
    slider->setSingleStep(1);
    slider->setValue(initial_value_int);
    slider->setProperty("min", min);
    slider->setProperty("max", max);
    slider->setProperty("step", step);
    slider->setProperty("param_widget_type", kParamDouble);
    QLabel* label = new QLabel(this);
    label->setText(QString::number((initial_value_int - min) * step));
    row_hbox->addWidget(new QLabel(name, this));
    row_hbox->addWidget(slider);
    row_hbox->addWidget(label);
    widgets_[name] = slider;
    layout_->addWidget(row_widget);
    slider->setProperty("param_widget_label", QVariant::fromValue(label));
    label->setProperty("format_str", "");
    connect(slider, &QSlider::valueChanged,
        [this, name, label, min, step](int position) {
          const double value = min + step * position;
          const QString format_str = label->property("format_str").toString();
          if (format_str == "") {
            label->setText(QString::number(value));
            label->setMinimumWidth(std::max(label->width(), label->minimumWidth()));
          } else {
            QString text;
            text.sprintf(format_str.toStdString().c_str(), value);
            label->setText(text);
          }
          emit ParamChanged(name);
        });
  } else {
    throw std::invalid_argument("Invalid display hint");
  }
}
开发者ID:ashuang,项目名称:sceneview,代码行数:60,代码来源:param_widget.cpp

示例7: FlashableWidget

KeyboardWidget::KeyboardWidget(int width, int height, QWidget *parent):
    FlashableWidget(width, height, parent)
{

    ifstream keyboardLayout;
    keyboardLayout.open("qwerty.txt");
    if(keyboardLayout.fail())
    {
        QMessageBox errorMessage;
        //If the layout isn't working
        errorMessage.setWindowTitle("Error");
        errorMessage.setIcon(QMessageBox::Critical);
        errorMessage.setText("Can't load the keyboard layout!");
        errorMessage.show();
    }
    else
    {
        for(int i = 0; i < vLabels_.size(); ++i)
        {
            string keyboardKey;
            keyboardLayout >> keyboardKey;
            QLabel *key = vLabels_.at(i);
            key->setText(QString::fromStdString(keyboardKey));
            key->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
            key->setMinimumWidth(90);
            key->setMinimumHeight(90);
        }
    }

}
开发者ID:TheBCIProject,项目名称:MindWriterQt,代码行数:30,代码来源:keyboardwidget.cpp

示例8: setNeuronImageFrame

/**
 * Draws neural network layer topology.
 */
void LayerEditWidget::setNeuronImageFrame() {
    QString labelStyle;

    if(inputLayer) {
        labelStyle =
            "background-image: url(:/neuron1w);"
            "background-position: center center;"
            "background-repeat: no-repeat;";
    } else {
        labelStyle =
            "background-image: url(:/neuron3w);"
            "background-position: center center;"
            "background-repeat: no-repeat;";
    }

    for(int i = 0; i < neuronList.count(); i++) {
        ui->neuronImageFrame->layout()->removeWidget(neuronList[i]);
        delete neuronList[i];
    }
    neuronList.clear();

    if(ui->neuronCountSpinBox->value() <= 7) {
        for(int i = 1; i < ui->neuronCountSpinBox->value()+1; i++) {
            QLabel* neuron = new QLabel(ui->neuronImageFrame);
            neuron->setMaximumWidth(36);
            neuron->setMinimumWidth(36);
            neuron->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
            neuron->setStyleSheet(labelStyle);
            neuron->setText(QString::number(i));
            neuronList.append(neuron);
            ui->neuronImageFrame->layout()->addWidget(neuron);
        }
    } else {
        for(int i = 1; i < 8; i++) {
            QLabel* neuron = new QLabel(ui->neuronImageFrame);
            neuron->setMaximumWidth(36);
            neuron->setMinimumWidth(36);
            neuron->setStyleSheet(labelStyle);
            neuron->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
            if(i == 7) neuron->setText(QString::number(ui->neuronCountSpinBox->value()));
            else if(i == 6)	neuron->setText(QString("..."));
            else neuron->setText(QString::number(i));
            neuronList.append(neuron);
            ui->neuronImageFrame->layout()->addWidget(neuron);
        }
    }
}
开发者ID:kacerpetr,项目名称:NNCreator,代码行数:50,代码来源:LayerEditWidget.cpp

示例9: setupStatusBar

void GreatWindow::setupStatusBar()
{
    QLabel* statusLabel = new QLabel("");
    statusLabel->setAlignment(Qt::AlignLeft);
    statusLabel->setMinimumWidth(100);

    QLabel* resolutionLabel = new QLabel("");
    resolutionLabel->setAlignment(Qt::AlignLeft);
    resolutionLabel->setMinimumWidth(150);

    QLabel* zoomLabel = new QLabel("");
    zoomLabel->setAlignment(Qt::AlignLeft);
    zoomLabel->setMinimumWidth(100);

    QLabel* urlLabel = new QLabel("");
    urlLabel->setAlignment(Qt::AlignLeft);
    urlLabel->setMinimumWidth(400);

    QPushButton* zoomInButton = new QPushButton(QString(0x2295));
    zoomInButton->setMaximumWidth(urlLabel->sizeHint().height());
    zoomInButton->setMaximumHeight(urlLabel->sizeHint().height());
    zoomInButton->setFocusPolicy(Qt::NoFocus);

    QPushButton* zoomOutButton = new QPushButton(QString(0x2296));
    zoomOutButton->setMaximumWidth(urlLabel->sizeHint().height());
    zoomOutButton->setMaximumHeight(urlLabel->sizeHint().height());
    zoomOutButton->setFocusPolicy(Qt::NoFocus);

    statusBar()->addWidget(statusLabel);
    statusBar()->addWidget(resolutionLabel);
    statusBar()->addWidget(zoomLabel);
    statusBar()->addWidget(zoomInButton);
    statusBar()->addWidget(zoomOutButton);
    statusBar()->addWidget(urlLabel, 1);

    m_statusLabels[0] = statusLabel;
    m_statusLabels[1] = resolutionLabel;
    m_statusLabels[2] = zoomLabel;
    m_statusLabels[3] = urlLabel;

    connect(zoomInButton, &QPushButton::clicked,
            m_canvas, [this] {m_canvas->zoom(true); updateZoom(); });
    connect(zoomOutButton, &QPushButton::clicked,
            m_canvas, [this] {m_canvas->zoom(false); updateZoom(); });
}
开发者ID:ricowang,项目名称:Great,代码行数:45,代码来源:greatwindow.cpp

示例10: c

VolumeDialogImpl::VolumeDialogImpl( QWidget* parent, Qt::WFlags fl )
    : QDialog( parent, fl ), m_tid(0), m_oldValue(0), m_d(new VolumeDialogImplPrivate)
{
    screenUpdate();

    QColor c(Qt::black);
    c.setAlpha(255);     //XXX: Make fully opaque for now, for  DirectPainter widgets in the background

    setAttribute(Qt::WA_SetPalette, true);

    QPalette p = palette();
    p.setBrush(QPalette::Window, c);
    setPalette(p);

    QVBoxLayout *vBox = new QVBoxLayout(this);
    QHBoxLayout *hBox = new QHBoxLayout;

    volumeWidget = new VolumeWidget(this);

    QIcon icon(":icon/sound");
    QIcon mute(":icon/mute");

    QLabel* volumeLevel = new QLabel(this);
    volumeLevel->setAlignment(Qt::AlignRight | Qt::AlignCenter);
    volumeLevel->setMinimumWidth( fontMetrics().width("100%") );
    volumeLevel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Maximum);
    connect(this, SIGNAL(setText(QString)), volumeLevel, SLOT(setText(QString)));

    volumeWidget->l = new QLabel(this);
    volumeWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
    volumeWidget->l->setPixmap(icon.pixmap(64, 64));
    volumeWidget->m = new QLabel(this);

    volumeWidget->m->hide();
    volumeWidget->m->setPixmap(mute.pixmap(64, 64));

    hBox->addStretch();
    hBox->addWidget(volumeWidget->l);
    hBox->addWidget(volumeWidget->m);
    hBox->addStretch();

    QHBoxLayout *wp = new QHBoxLayout;
    wp->addWidget(volumeWidget);
    wp->addWidget(volumeLevel);

    vBox->addLayout(hBox);
    vBox->addLayout(wp);

    connect(m_d->m_vsVolume, SIGNAL(contentsChanged()), this, SLOT(valueSpaceVolumeChanged()));
    initialized = 0;
    old_slot = 0;

    resetTimer();
}
开发者ID:Camelek,项目名称:qtmoko,代码行数:54,代码来源:volumeimpl.cpp

示例11: QDialog

SaveScm::SaveScm( QWidget *parent, const char *name )
	: QDialog( parent, name, TRUE )
{
	setFocusPolicy(QWidget::StrongFocus);
	setCaption( i18n("Add a color scheme"));
	
	QBoxLayout *topLayout = new QVBoxLayout( this, 10 );

	QBoxLayout *stackLayout = new QVBoxLayout( 3 );
	topLayout->addLayout( stackLayout );

	nameLine = new QLineEdit( this );
	nameLine->setFocus();
	nameLine->setMaxLength(18);
	nameLine->setFixedHeight( nameLine->sizeHint().height() );
	
	QLabel* tmpQLabel;
	tmpQLabel = new QLabel( nameLine, 
			i18n( "&Enter a name for the new color scheme\n"\
					"to be added to your personal list.\n\n"\
					"The colors currently used in the preview will\n"\
					"be copied into this scheme to begin with." ), this );
	tmpQLabel->setAlignment( AlignLeft | AlignBottom | ShowPrefix );
	tmpQLabel->setFixedHeight( tmpQLabel->sizeHint().height() );
	tmpQLabel->setMinimumWidth( tmpQLabel->sizeHint().width() );
	
	stackLayout->addStretch( 10 );
	stackLayout->addWidget( tmpQLabel );
	stackLayout->addWidget( nameLine );
	
	QFrame* tmpQFrame;
	tmpQFrame = new QFrame( this );
	tmpQFrame->setFrameStyle( QFrame::HLine | QFrame::Sunken );
	tmpQFrame->setMinimumHeight( tmpQFrame->sizeHint().height() );
	
	topLayout->addWidget( tmpQFrame );
	
	KButtonBox *bbox = new KButtonBox( this );
	bbox->addStretch( 10 );
	
	QPushButton *ok = bbox->addButton( i18n( "&OK" ) );
	connect( ok, SIGNAL( clicked() ), SLOT( accept() ) );
	
	QPushButton *cancel = bbox->addButton( i18n( "&Cancel" ) );
	connect( cancel, SIGNAL( clicked() ), SLOT( reject() ) );
	
	bbox->layout();
	topLayout->addWidget( bbox );

    topLayout->activate();
	
	resize( 250, 0 );
}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:53,代码来源:savescm.cpp

示例12: QGraphicsProxyWidget

QGraphicsProxyWidget *
UpcomingEventsWidget::createLabel( const QString &text, QSizePolicy::Policy hPolicy )
{
    QLabel *label = new QLabel;
    label->setAttribute( Qt::WA_NoSystemBackground );
    label->setMinimumWidth( 10 );
    label->setSizePolicy( hPolicy, QSizePolicy::Preferred );
    label->setText( text );
    label->setWordWrap( false );
    QGraphicsProxyWidget *proxy = new QGraphicsProxyWidget( this );
    proxy->setWidget( label );
    return proxy;
}
开发者ID:ErrAza,项目名称:amarok,代码行数:13,代码来源:UpcomingEventsWidget.cpp

示例13: addLabel

void ModelPanel::addLabel(QGridLayout * gridLayout, QString text, int col, bool minimize)
{
  QLabel *label = new QLabel(this);
  label->setFrameShape(QFrame::Panel);
  label->setFrameShadow(QFrame::Raised);
  label->setMidLineWidth(0);
  label->setAlignment(Qt::AlignCenter);
  label->setMargin(5);
  label->setText(text);
  if (!minimize)
    label->setMinimumWidth(100);
  gridLayout->addWidget(label, 0, col, 1, 1);
}
开发者ID:andyjenkinson,项目名称:opentx,代码行数:13,代码来源:modelpanel.cpp

示例14: setWindowTitle

//! [Dialog constructor part1]
Dialog::Dialog()
{
    desktopGeometry = QApplication::desktop()->availableGeometry(0);

    setWindowTitle(tr("SIP Dialog Example"));
    QScrollArea *scrollArea = new QScrollArea(this);
    QGroupBox *groupBox = new QGroupBox(scrollArea);
    groupBox->setTitle(tr("SIP Dialog Example"));
    QGridLayout *gridLayout = new QGridLayout(groupBox);
    groupBox->setLayout(gridLayout);
//! [Dialog constructor part1]

//! [Dialog constructor part2]
    QLineEdit* lineEdit = new QLineEdit(groupBox);
    lineEdit->setText(tr("Open and close the SIP"));
    lineEdit->setMinimumWidth(220);

    QLabel* label = new QLabel(groupBox);
    label->setText(tr("This dialog resizes if the SIP is opened"));
    label->setMinimumWidth(220);

    QPushButton* button = new QPushButton(groupBox);
    button->setText(tr("Close Dialog"));
    button->setMinimumWidth(220);
//! [Dialog constructor part2]

//! [Dialog constructor part3]
    if (desktopGeometry.height() < 400)
        gridLayout->setVerticalSpacing(80);
    else
        gridLayout->setVerticalSpacing(150);

    gridLayout->addWidget(label);
    gridLayout->addWidget(lineEdit);
    gridLayout->addWidget(button);
//! [Dialog constructor part3]

//! [Dialog constructor part4]
    scrollArea->setWidget(groupBox);
    QHBoxLayout* layout = new QHBoxLayout();
    layout->addWidget(scrollArea);
    setLayout(layout);
    scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
//! [Dialog constructor part4]

//! [Dialog constructor part5]
    connect(button, SIGNAL(clicked()),
        qApp, SLOT(closeAllWindows()));
    connect(QApplication::desktop(), SIGNAL(workAreaResized(int)), 
        this, SLOT(desktopResized(int)));
}
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.vendor,代码行数:52,代码来源:dialog.cpp

示例15: connect

SymbolsFindFilterConfigWidget::SymbolsFindFilterConfigWidget(SymbolsFindFilter *filter)
    : m_filter(filter)
{
    connect(m_filter, SIGNAL(symbolsToSearchChanged()), this, SLOT(getState()));

    QGridLayout *layout = new QGridLayout(this);
    setLayout(layout);
    layout->setMargin(0);

    QLabel *typeLabel = new QLabel(tr("Types:"));
    layout->addWidget(typeLabel, 0, 0);

    m_typeClasses = new QCheckBox(tr("Classes"));
    layout->addWidget(m_typeClasses, 0, 1);

    m_typeMethods = new QCheckBox(tr("Functions"));
    layout->addWidget(m_typeMethods, 0, 2);

    m_typeEnums = new QCheckBox(tr("Enums"));
    layout->addWidget(m_typeEnums, 1, 1);

    m_typeDeclarations = new QCheckBox(tr("Declarations"));
    layout->addWidget(m_typeDeclarations, 1, 2);

    // hacks to fix layouting:
    typeLabel->setMinimumWidth(80);
    typeLabel->setAlignment(Qt::AlignRight);
    m_typeClasses->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    m_typeMethods->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);

    connect(m_typeClasses, SIGNAL(clicked(bool)), this, SLOT(setState()));
    connect(m_typeMethods, SIGNAL(clicked(bool)), this, SLOT(setState()));
    connect(m_typeEnums, SIGNAL(clicked(bool)), this, SLOT(setState()));
    connect(m_typeDeclarations, SIGNAL(clicked(bool)), this, SLOT(setState()));

    m_searchProjectsOnly = new QRadioButton(tr("Projects only"));
    layout->addWidget(m_searchProjectsOnly, 2, 1);

    m_searchGlobal = new QRadioButton(tr("All files"));
    layout->addWidget(m_searchGlobal, 2, 2);

    m_searchGroup = new QButtonGroup(this);
    m_searchGroup->addButton(m_searchProjectsOnly);
    m_searchGroup->addButton(m_searchGlobal);

    connect(m_searchProjectsOnly, SIGNAL(clicked(bool)),
            this, SLOT(setState()));
    connect(m_searchGlobal, SIGNAL(clicked(bool)),
            this, SLOT(setState()));
}
开发者ID:Gardenya,项目名称:qtcreator,代码行数:50,代码来源:symbolsfindfilter.cpp


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