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


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

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


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

示例1: QWidget

TargetList::TargetList(QWidget *parent) :
    QWidget(parent)
{

    targetTable = new QTableWidget(1,3,this);
    scanLocTable = new QTableWidget(1,5,this);
    QLabel* targetTableLabel = new QLabel("&Targets");
    QLabel* scanLocTableLabel = new QLabel("ROI locations");
    QStringList ttHeaders;
    ttHeaders.append("Target Number");
    ttHeaders.append("x (um)");
    ttHeaders.append("y (um)");
    targetTable->setHorizontalHeaderLabels(ttHeaders);
    QStringList sltHeaders;
    sltHeaders.append("ROI Number");
    sltHeaders.append("x (um)");
    sltHeaders.append("y (um)");
    sltHeaders.append("x width");
    sltHeaders.append("y width");
    scanLocTable->setHorizontalHeaderLabels(sltHeaders);

    targetTableLabel->setBuddy(targetTable);


    connect(targetTable,SIGNAL(cellClicked(int,int)), this, SLOT(updateScanTable(int,int)));

    mainLayout = new QGridLayout;
    mainLayout->addWidget(targetTableLabel,0,0);
    mainLayout->addWidget(targetTable, 1,0,3,1);
    mainLayout->addWidget(scanLocTableLabel,0,1);
    mainLayout->addWidget(scanLocTable,1,2,3,2 );

    scanLocTable->adjustSize();
    targetTable->adjustSize();

    setLayout(mainLayout);
    qDebug()<<"constructed targettable";
    qDebug()<<QString::number(scanLocTable->isVisible());
    LandmarkList fakeTargetList;
    LocationSimple testLoc1;

    fakeTargetList.append(testLoc1);

    QList<LandmarkList> fakeScanLocations;
    fakeScanLocations.append(fakeTargetList);



    updateTargetTable(fakeTargetList, fakeScanLocations);

}
开发者ID:RobertLu5566,项目名称:vaa3d_tools,代码行数:51,代码来源:targetList.cpp

示例2: QVLCFrame

PluginDialog::PluginDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
{
    setAttribute( Qt::WA_DeleteOnClose );

    setWindowTitle( qtr( "Plugins and extensions" ) );
    QGridLayout *layout = new QGridLayout( this );

    /* Main Tree for modules */
    treePlugins = new QTreeWidget;
    layout->addWidget( treePlugins, 0, 0, 1, -1 );

    /* Users cannot move the columns around but we need to sort */
    treePlugins->header()->setMovable( false );
    treePlugins->header()->setSortIndicatorShown( true );
    //    treePlugins->header()->setResizeMode( QHeaderView::ResizeToContents );
    treePlugins->setAlternatingRowColors( true );
    treePlugins->setColumnWidth( 0, 200 );

    QStringList headerNames;
    headerNames << qtr("Name") << qtr("Capability" ) << qtr( "Score" );
    treePlugins->setHeaderLabels( headerNames );

    FillTree();

    /* Set capability column to the correct Size*/
    treePlugins->resizeColumnToContents( 1 );
    treePlugins->header()->restoreState(
            getSettings()->value( "Plugins/Header-State" ).toByteArray() );

    treePlugins->setSortingEnabled( true );
    treePlugins->sortByColumn( 1, Qt::AscendingOrder );

    QLabel *label = new QLabel( qtr("&Search:"), this );
    edit = new SearchLineEdit( this );
    label->setBuddy( edit );

    layout->addWidget( label, 1, 0 );
    layout->addWidget( edit, 1, 1, 1, -1 );
    CONNECT( edit, textChanged( const QString& ),
            this, search( const QString& ) );

    QDialogButtonBox *box = new QDialogButtonBox;
    QPushButton *okButton = new QPushButton( qtr( "&Close" ), this );
    box->addButton( okButton, QDialogButtonBox::AcceptRole );
    layout->addWidget( box, 2, 2 );

    BUTTONACT( okButton, close() );

    setMinimumSize( 500, 300 );
    readSettings( "Plugins", QSize( 540, 400 ) );
}
开发者ID:Kafay,项目名称:vlc,代码行数:51,代码来源:plugins.cpp

示例3: QVBox

QWidget * DataRecorderChannelBoolean::getPropertyWidget(QWidget * parent, const char * name)
{
	if (!m_propertyWidget)
	{
		// Setup widget
		QVBox * widget = new QVBox(parent,name);
		Q_CHECK_PTR(widget);
		widget->setMargin(KDialog::marginHint());
		widget->setSpacing(KDialog::spacingHint());
		
		QLabel * lab;
		lab = new QLabel(i18n("DataRecorder", "Channel:"), widget);
		Q_CHECK_PTR(lab);
		
		KSimLineEdit * conName;
		conName = new KSimLineEdit(widget);
		Q_CHECK_PTR(conName);
		conName->setText(getConnector()->getName());
		connect(getConnector(), SIGNAL(signalSetName(const QString &)), conName, SLOT(setText(const QString &)));
		connect(conName, SIGNAL(changed(const QString &)), SLOT(setChannelName(const QString &)));
		lab->setBuddy(conName);
		// TODO add ToolTip

		
		ChannelPositionWidget * pos;
		pos = new ChannelPositionWidget(this, widget);
		Q_CHECK_PTR(pos);
		pos->setGainValue(getVerticalGain());
		pos->setOffsetValue(getVerticalOffset());
		connect(pos, SIGNAL(gainChanged(double)), SLOT(setVerticalGain(double)));
		connect(pos, SIGNAL(offsetChanged(double)), SLOT(setVerticalOffset(double)));
		
		
		KColorButton * color = new KColorButton(widget);
		Q_CHECK_PTR(color);
		color->setColor(getLineColor());
		connect(color, SIGNAL(changed(const QColor &)), SLOT(setLineColor(const QColor &)));
		
		
		m_propertyWidget = widget;
	}
	else
	{
		if (parent)
		{
			KSIMDEBUG("Only one widget allowed");
		}
	}
		
	return m_propertyWidget;	
}
开发者ID:BackupTheBerlios,项目名称:ksimus,代码行数:51,代码来源:datarecorderchannelboolean.cpp

示例4: KDialog

KMail::ACLEntryDialog::ACLEntryDialog( IMAPUserIdFormat userIdFormat, const QString& caption, QWidget* parent )
  : KDialog( parent )
  , mUserIdFormat( userIdFormat )
{
  setCaption( caption );
  setButtons( Ok | Cancel );
  QWidget *page = new QWidget( this );
  setMainWidget(page);
  QGridLayout *topLayout = new QGridLayout( page );
  topLayout->setSpacing( spacingHint() );
  topLayout->setMargin( 0 );

  QLabel *label = new QLabel( i18n( "&User identifier:" ), page );
  topLayout->addWidget( label, 0, 0 );

  mUserIdLineEdit = new KLineEdit( page );
  topLayout->addWidget( mUserIdLineEdit, 0, 1 );
  label->setBuddy( mUserIdLineEdit );
  mUserIdLineEdit->setWhatsThis( i18n( "The User Identifier is the login of the user on the IMAP server. This can be a simple user name or the full email address of the user; the login for your own account on the server will tell you which one it is." ) );

  QPushButton* kabBtn = new QPushButton( i18n( "Se&lect..." ), page );
  topLayout->addWidget( kabBtn, 0, 2 );

  QGroupBox* groupBox = new QGroupBox( i18n( "Permissions" ), page );
  QVBoxLayout *vbox = new QVBoxLayout( groupBox );

  mButtonGroup = new QButtonGroup( groupBox );

  for ( unsigned int i = 0;
        i < sizeof( standardPermissions ) / sizeof( *standardPermissions );
        ++i ) {
    QRadioButton* cb = new QRadioButton( i18nc( "Permissions", standardPermissions[i].userString ), groupBox );
    vbox->addWidget( cb );
    // We store the permission value (bitfield) as the id of the radiobutton in the group
    mButtonGroup->addButton( cb, standardPermissions[i].permissions );
  }

  vbox->addStretch( 1 );

  topLayout->addWidget( groupBox, 1, 0, 1, 3 );
  topLayout->setRowStretch(2, 10);

  connect( mUserIdLineEdit, SIGNAL( textChanged( const QString& ) ), SLOT( slotChanged() ) );
  connect( kabBtn, SIGNAL( clicked() ), SLOT( slotSelectAddresses() ) );
  connect( mButtonGroup, SIGNAL( buttonClicked( int ) ), SLOT( slotChanged() ) );
  enableButtonOk( false );

  mUserIdLineEdit->setFocus();
  // Ensure the lineedit is rather wide so that email addresses can be read in it
  incrementInitialSize( QSize( 200, 0 ) );
}
开发者ID:akhuettel,项目名称:kdepim-noakonadi,代码行数:51,代码来源:folderdialogacltab.cpp

示例5: QDialog

GoGui::GoGui(QWidget *parent) :
  QDialog(parent) {
  //BoardScene *boardScene = BoardScene::createGoScene(13);
  BoardScene *boardScene = BoardScene::createHavannahScene(8);
  BoardView *boardView = new BoardView(boardScene, this);
  manager *m = new manager(boardScene, this);

  labelEdit = new QLineEdit;
  QLabel *labelLabel = new QLabel("Label");
  labelLabel->setBuddy(labelEdit);
  labelEdit->setEnabled(false);

  QComboBox *typeComboBox = new QComboBox;
  QLabel *typeLabel = new QLabel("Type");
  typeLabel->setBuddy(typeComboBox);
  typeComboBox->addItem("Black Stone");
  typeComboBox->addItem("White Stone");
  typeComboBox->addItem("Mark");
  typeComboBox->addItem("Circle");
  typeComboBox->addItem("Square");
  typeComboBox->addItem("Triangle");
  typeComboBox->addItem("Label");

  QGridLayout *layout = new QGridLayout;
  layout->addWidget(labelLabel, 0, 0);
  layout->addWidget(labelEdit, 0, 1);
  layout->addWidget(typeLabel, 1, 0);
  layout->addWidget(typeComboBox, 1, 1);

  QVBoxLayout *mainLayout = new QVBoxLayout;
  mainLayout->addWidget(boardView);
  mainLayout->addLayout(layout);

  connect(typeComboBox, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(typeIndexChanged(const QString& )));
  connect(typeComboBox, SIGNAL(currentIndexChanged(int)), m, SLOT(setIndex(int)));
  connect(labelEdit, SIGNAL(textChanged(const QString &)), m, SLOT(setLabel(const QString&)));
  setLayout(mainLayout);
}
开发者ID:PawelTroka,项目名称:LogicalGamesEnginesGenerator,代码行数:38,代码来源:gogui.cpp

示例6: ConfigGui

ConfigGuiOpie::ConfigGuiOpie(const QSync::Member &member, QWidget *parent)
    : ConfigGui(member, parent)
{
    QGridLayout *layout = new QGridLayout(topLayout());

    QLabel *label = new QLabel(i18n("Device IP:"), this);
    layout->addWidget(label, 0, 0);

    mDeviceIP = new QLineEdit(this);
    mDeviceIP->setInputMask("000.000.000.000");
    label->setBuddy(mDeviceIP);
    layout->addWidget(mDeviceIP, 0, 1);

    label = new QLabel(i18n("Device Type:"), this);
    layout->addWidget(label, 1, 0);

    mDeviceType = new QComboBox(this);
    label->setBuddy(mDeviceType);
    layout->addWidget(mDeviceType, 1, 1);

    label = new QLabel(i18n("Username:"), this);
    layout->addWidget(label, 2, 0);

    mUserName = new QLineEdit(this);
    label->setBuddy(mUserName);
    layout->addWidget(mUserName, 2, 1);

    label = new QLabel(i18n("Password:"), this);
    layout->addWidget(label, 3, 0);

    mPassword = new QLineEdit(this);
    mPassword->setEchoMode(QLineEdit::Password);
    label->setBuddy(mPassword);
    layout->addWidget(mPassword, 3, 1);

    label = new QLabel(i18n("Protocol:"), this);
    layout->addWidget(label, 4, 0);

    mConnectionType = new QComboBox(this);
    label->setBuddy(mConnectionType);
    layout->addWidget(mConnectionType, 4, 1);

    label = new QLabel(i18n("Port:"), this);
    layout->addWidget(label, 5, 0);

    mPort = new QSpinBox(this);
    mPort->setRange(0, 65335);
    label->setBuddy(mPort);
    layout->addWidget(mPort, 5, 1);

    mDeviceType->insertItem(i18n("Opie/OpenZaurus"));
    mDeviceType->insertItem(i18n("Qtopia2"));

    mConnectionType->insertItem(i18n("SCP"));
    mConnectionType->insertItem(i18n("FTP"));

    topLayout()->addStretch(1);
}
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:58,代码来源:configguiopie.cpp

示例7: QLabel

CSendFileWidget::CSendFileWidget( QWidget* parent ) :
QWidget( parent )
{
	QLabel* serverHostLabel = new QLabel( "&Server address: ", this );
	host = new QLineEdit( this );
	serverHostLabel->setBuddy( host );

	QLabel* portLabel = new QLabel( "Server &Port:", this );
	port = new QSpinBox( this );
	port->setMinimum( 0 );
	port->setMaximum( SHRT_MAX );
	portLabel->setBuddy( port );

	QLabel* fileLabel = new QLabel( "&File:", this );
	fileName = new QLineEdit( this );

	QPushButton* openFileDialogBtn = new QPushButton( "...", this );
	QPushButton* transmit = new QPushButton( "Transmit", this );

	/*QHBoxLayout* selectFileLayout = new QHBoxLayout( this );
	selectFileLayout->addWidget( fileName );
	selectFileLayout->addWidget( openFileDialogBtn );*/

	QVBoxLayout* layout = new QVBoxLayout( this );
	layout->addWidget( serverHostLabel );
	layout->addWidget( host );
	layout->addWidget( portLabel );
	layout->addWidget( port );
	layout->addWidget( fileLabel );
	layout->addWidget( fileName );
	layout->addWidget( openFileDialogBtn );
	layout->addWidget( transmit );

	setLayout( layout );

	connect( openFileDialogBtn, SIGNAL( clicked() ), this, SLOT( onSelectFileButtonClick() ) );
	connect( transmit, SIGNAL( clicked() ), this, SLOT( onTransferButtonClick() ) );
}
开发者ID:fantomius,项目名称:CMouse,代码行数:38,代码来源:SendFileWidget.cpp

示例8: Filter

PlayabilityFilter::PlayabilityFilter(ListerDialog *dialog)
    : Filter(dialog)
{
    QHBoxLayout *minRankLayout = new QHBoxLayout;
    m_vbox->addLayout(minRankLayout);

    QLabel *minRankLabel = new QLabel(tr("&Minimum rank:"));
    minRankLayout->addWidget(minRankLabel);
    m_minRankSpinner = ListerDialog::makeSpinBox(0, 99999, 100);
    m_minRankSpinner->setSpecialValueText(tr("none"));
    minRankLabel->setBuddy(m_minRankSpinner);
    minRankLayout->addWidget(m_minRankSpinner);

    QHBoxLayout *maxRankLayout = new QHBoxLayout;
    m_vbox->addLayout(maxRankLayout);

    QLabel *maxRankLabel = new QLabel(tr("Ma&ximum rank:"));
    maxRankLayout->addWidget(maxRankLabel);
    m_maxRankSpinner = ListerDialog::makeSpinBox(0, 99999, 100);
    m_maxRankSpinner->setSpecialValueText(tr("none"));
    maxRankLabel->setBuddy(m_maxRankSpinner);
    maxRankLayout->addWidget(m_maxRankSpinner);
}
开发者ID:liesen,项目名称:quackle,代码行数:23,代码来源:lister.cpp

示例9: setupFontEncodingBox

void FontDialog::setupFontEncodingBox()
{
    QGroupBox *gb = new QGroupBox(i18n("Encoding"), mainWidget());

    QGridLayout *layout = new QGridLayout(gb);
    layout->setSpacing(KDialog::spacingHint());
    layout->setMargin(KDialog::marginHint() * 2);

    QLabel *lDefaultEncoding = new QLabel(i18n("&Default encoding:"), gb);
    layout->addWidget(lDefaultEncoding, 0, 0);
    m_defaultEncoding = new KComboBox(false, gb);
    layout->addWidget(m_defaultEncoding, 0, 1);
    QStringList encodings = KGlobal::charsets()->availableEncodingNames();
    encodings.prepend(i18n("Use Language Encoding"));
    m_defaultEncoding->insertStringList(encodings);
    lDefaultEncoding->setBuddy(m_defaultEncoding);

    QLabel *lFontSizeAdjustement = new QLabel(i18n("&Font size adjustment:"), gb);
    layout->addWidget(lFontSizeAdjustement, 1, 0);
    m_fontSizeAdjustement = new QSpinBox(-5, 5, 1, gb);
    layout->addWidget(m_fontSizeAdjustement, 1, 1);
    lFontSizeAdjustement->setBuddy(m_fontSizeAdjustement);
}
开发者ID:serghei,项目名称:kde3-kdebase,代码行数:23,代码来源:fontdialog.cpp

示例10: KHBox

FilterSelectionWidget::FilterSelectionWidget( QWidget *parent )
  : KHBox( parent )
{
  setSpacing( KDialog::spacingHint() );

  QLabel *label = new QLabel( i18n( "Filter:" ), this );
  label->setObjectName( "kde toolbar widget" );

  mFilterCombo = new KComboBox( this );
  mFilterCombo->setMaximumWidth( 200 );
  label->setBuddy( mFilterCombo );
  connect( mFilterCombo, SIGNAL( activated( int ) ),
           this, SIGNAL( filterActivated( int ) ) );
}
开发者ID:akhuettel,项目名称:kdepim-noakonadi,代码行数:14,代码来源:filterselectionwidget.cpp

示例11: LoginDialog

    LoginDialog(QWidget *parent = 0)
        : QDialog(parent)
    {
        QGridLayout *gl = new QGridLayout;
        setLayout(gl);

        QLabel *l;

        l = new QLabel("&Login:", this);
        gl->addWidget(l, 0, 0);
        lle = new QLineEdit(this);
        gl->addWidget(lle, 0, 1);
        l->setBuddy(lle);

        l = new QLabel("&Password:", this);
        gl->addWidget(l, 1, 0);
        ple = new QLineEdit(this);
        ple->setEchoMode(QLineEdit::Password);
        gl->addWidget(ple, 1, 1);
        l->setBuddy(ple);

        QWidget *hbox = new QWidget(this);
        QHBoxLayout *hboxlayout = new QHBoxLayout;

        gl->addWidget(hbox, 2, 0, 1, 2);

        QPushButton *pb;
        pb = new QPushButton("&Ok");
        connect(pb, SIGNAL(clicked()), this, SLOT(accept()));
        hboxlayout->addWidget(pb);

        pb = new QPushButton("&Cancel");
        connect(pb, SIGNAL(clicked()), this, SLOT(reject()));
        hboxlayout->addWidget(pb);

        hbox->setLayout(hboxlayout);
    }
开发者ID:AtlantisCD9,项目名称:qttelnet-2.1-opensource,代码行数:37,代码来源:main.cpp

示例12: setupGUI

void LoginDialog::setupGUI() {
    // setup a grid layout
    QGridLayout* formGridLayout = new QGridLayout(this);
 
    _usernameLineEdit = new QLineEdit(this);
    
    QLabel* usernameLabel = new QLabel(this);
    usernameLabel->setText("Username");
    usernameLabel->setBuddy(_usernameLineEdit);
    
    formGridLayout->addWidget(usernameLabel, 0, 0);
    formGridLayout->addWidget(_usernameLineEdit, 1, 0);
    
    _passwordLineEdit = new QLineEdit(this);
    _passwordLineEdit->setEchoMode(QLineEdit::Password);

    QLabel* passwordLabel = new QLabel(this);
    passwordLabel->setText("Password");
    passwordLabel->setBuddy(_passwordLineEdit);
    
    formGridLayout->addWidget(passwordLabel, 2, 0);
    formGridLayout->addWidget(_passwordLineEdit, 3, 0);
    
    QDialogButtonBox* buttons = new QDialogButtonBox(this);
    
    QPushButton* okButton = buttons->addButton(QDialogButtonBox::Ok);
    QPushButton* cancelButton = buttons->addButton(QDialogButtonBox::Cancel);
    
    okButton->setText("Login");
    
    connect(cancelButton, &QPushButton::clicked, this, &QDialog::close);
    connect(okButton, &QPushButton::clicked, this, &LoginDialog::loginButtonClicked);
    
    formGridLayout->addWidget(buttons, 4, 0, 1, 2);
    
    setLayout(formGridLayout);
}
开发者ID:AlphaStaxLLC,项目名称:hifi,代码行数:37,代码来源:LoginDialog.cpp

示例13: KDialog

//// A dialog to load a KDE icon by its name
LoadIconDialog::LoadIconDialog(QWidget *parent)
        : KDialog(parent, "loadicon_dialog", true, i18n("Load KDE Icon by Name"), Ok | Cancel, Ok, false)
{
    QFrame *frame = makeMainWidget();
    QGridLayout *l = new QGridLayout(frame);

    // Name input
    QLabel *name = new QLabel(i18n("&Name:"), frame);
    l->addWidget(name, 0, 0);
    name->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    m_nameInput = new KLineEdit("kexi", frame);
    l->addWidget(m_nameInput, 0, 1);
    name->setBuddy(m_nameInput);

    // Choose size
    QLabel *size = new QLabel(i18n("&Size:"), frame);
    l->addWidget(size, 1, 0);
    size->setAlignment(Qt::AlignRight | Qt::AlignVCenter);

    KComboBox *combo = new KComboBox(frame);
    l->addWidget(combo, 1, 1);
    size->setBuddy(combo);
    QStringList list;
    list << i18n("Small") << i18n("Medium") << i18n("Large") << i18n("Huge");
    combo->insertStringList(list);
    combo->setCurrentItem(2);
    connect(combo, SIGNAL(activated(int)), this, SLOT(changeIconSize(int)));


    // Icon chooser button
    m_button = new KIconButton(frame);
    m_button->setIcon(koIconName("calligrakexi"));
    m_button->setIconSize(KIconLoader::SizeMedium);
    l->addWidget(m_button, 0, 2, 2, 1);
    connect(m_button, SIGNAL(iconChanged(QString)), this, SLOT(updateIconName(QString)));
    connect(m_nameInput, SIGNAL(textChanged(QString)), this, SLOT(setIcon(QString)));
}
开发者ID:abhishekmurthy,项目名称:Calligra,代码行数:38,代码来源:pixmapcollection.cpp

示例14: addFormatTab

void DiffPage::addFormatTab()
{
	QWidget* page   = new QWidget( this );
	QVBoxLayout* layout = new QVBoxLayout( page );
	layout->setSpacing( KDialog::spacingHint() );
	layout->setMargin( KDialog::marginHint() );

	// add diff modes
	m_modeButtonGroup = new QButtonGroup( page );
        QGroupBox *box = new QGroupBox( page );
	box->setWhatsThis( i18n( "Select the format of the output generated by diff. Unified is the one that is used most frequently because it is very readable. The KDE developers like this format the best so use it for sending patches." ) );
	layout->addWidget( box );
	QVBoxLayout* bgLayout = new QVBoxLayout( box );
	box->setTitle( i18n( "Output Format" ) );
	//m_modeButtonGroup->setMargin( KDialog::marginHint() );

        QRadioButton *radioButton = new QRadioButton( i18n( "Context" ), box );
        m_modeButtonGroup->addButton( radioButton, Kompare::Context);
	bgLayout->addWidget( radioButton );
        radioButton = new QRadioButton( i18n( "Normal" ),  box );
        m_modeButtonGroup->addButton( radioButton, Kompare::Normal);
        bgLayout->addWidget( radioButton );
        radioButton =  new QRadioButton( i18n( "Unified" ), box );
        m_modeButtonGroup->addButton( radioButton, Kompare::Unified);
        bgLayout->addWidget( radioButton );

	// #lines of context (loc)
	QGroupBox* groupBox = new QGroupBox( page );
        QHBoxLayout *groupLayout = new QHBoxLayout;
        groupBox->setLayout( groupLayout );
	layout->addWidget( groupBox );
	groupBox->setTitle( i18n( "Lines of Context" ) );
	groupBox->setWhatsThis( i18n( "The number of context lines is normally 2 or 3. This makes the diff readable and applicable in most cases. More than 3 lines will only bloat the diff unnecessarily." ) );
	//groupBox->setMargin( KDialog::marginHint() );

	QLabel* label = new QLabel( i18n( "Number of context lines:" ));
        groupLayout->addWidget( label );
	label->setWhatsThis( i18n( "The number of context lines is normally 2 or 3. This makes the diff readable and applicable in most cases. More than 3 lines will only bloat the diff unnecessarily." ) );
	m_locSpinBox = new QSpinBox( groupBox );
	m_locSpinBox->setRange( 0, 100 );
	groupLayout->addWidget( m_locSpinBox );
	m_locSpinBox->setWhatsThis( i18n( "The number of context lines is normally 2 or 3. This makes the diff readable and applicable in most cases. More than 3 lines will only bloat the diff unnecessarily." ) );
	label->setBuddy( m_locSpinBox );

	layout->addStretch( 1 );
	page->setMinimumSize( sizeHintForWidget( page ) );

	m_tabWidget->addTab( page, i18n( "Format" ) );
}
开发者ID:ShermanHuang,项目名称:kdesdk,代码行数:49,代码来源:diffpage.cpp

示例15: QFrame

SoundPicker::SoundPicker(QWidget* parent)
    : QFrame(parent),
      mRevertType(false)
{
    QHBoxLayout* soundLayout = new QHBoxLayout(this);
    soundLayout->setMargin(0);
    soundLayout->setSpacing(KDialog::spacingHint());
    mTypeBox = new KHBox(this);    // this is to control the QWhatsThis text display area
    mTypeBox->setMargin(0);
    mTypeBox->setSpacing(KDialog::spacingHint());

    QLabel* label = new QLabel(i18n_label_Sound(), mTypeBox);
    label->setFixedSize(label->sizeHint());

    // Sound type combo box
    // The order of combo box entries must correspond with the 'Type' enum.
    if (indexes.isEmpty())
    {
        indexes[Preferences::Sound_None]     = 0;
        indexes[Preferences::Sound_Beep]     = 1;
        indexes[Preferences::Sound_File] = 2;
        indexes[Preferences::Sound_Speak]    = 3;
    }

    mTypeCombo = new ComboBox(mTypeBox);
    mTypeCombo->addItem(i18n_combo_None());     // index None
    mTypeCombo->addItem(i18n_combo_Beep());     // index Beep
    mTypeCombo->addItem(i18n_combo_File());     // index PlayFile
    mSpeakShowing = !theApp()->speechEnabled();
    showSpeak(!mSpeakShowing);            // index Speak (only displayed if appropriate)
    connect(mTypeCombo, SIGNAL(activated(int)), SLOT(slotTypeSelected(int)));
    connect(mTypeCombo, SIGNAL(currentIndexChanged(int)), SIGNAL(changed()));
    label->setBuddy(mTypeCombo);
    soundLayout->addWidget(mTypeBox);

    // Sound file picker button
    mFilePicker = new PushButton(this);
    mFilePicker->setIcon(KIcon(SmallIcon("audio-x-generic")));
    int size = mFilePicker->sizeHint().height();
    mFilePicker->setFixedSize(size, size);
    connect(mFilePicker, SIGNAL(clicked()), SLOT(slotPickFile()));
    mFilePicker->setToolTip(i18nc("@info:tooltip", "Configure sound file"));
    mFilePicker->setWhatsThis(i18nc("@info:whatsthis", "Configure a sound file to play when the alarm is displayed."));
    soundLayout->addWidget(mFilePicker);

    // Initialise the file picker button state and tooltip
    mTypeCombo->setCurrentIndex(indexes[Preferences::Sound_None]);
    mFilePicker->setEnabled(false);
}
开发者ID:chusopr,项目名称:kdepim-ktimetracker-akonadi,代码行数:49,代码来源:soundpicker.cpp


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