本文整理汇总了C++中KComboBox::delegate方法的典型用法代码示例。如果您正苦于以下问题:C++ KComboBox::delegate方法的具体用法?C++ KComboBox::delegate怎么用?C++ KComboBox::delegate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KComboBox
的用法示例。
在下文中一共展示了KComboBox::delegate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: historyConfig
KComboBoxTest::KComboBoxTest(TQWidget* widget, const char* name )
:TQWidget(widget, name)
{
TQVBoxLayout *vbox = new TQVBoxLayout (this, KDialog::marginHint(), KDialog::spacingHint());
// Test for KCombo's KLineEdit destruction
KComboBox *testCombo = new KComboBox( true, this ); // rw, with KLineEdit
testCombo->setEditable( false ); // destroys our KLineEdit
assert( testCombo->delegate() == 0L );
delete testCombo; // not needed anymore
// Qt combobox
TQHBox* hbox = new TQHBox(this);
hbox->setSpacing (KDialog::spacingHint());
TQLabel* lbl = new TQLabel("&QCombobox:", hbox);
lbl->setSizePolicy (TQSizePolicy::Maximum, TQSizePolicy::Preferred);
m_qc = new TQComboBox(hbox, "QtReadOnlyCombo" );
lbl->setBuddy (m_qc);
TQObject::connect (m_qc, TQT_SIGNAL(activated(int)), TQT_SLOT(slotActivated(int)));
TQObject::connect (m_qc, TQT_SIGNAL(activated(const TQString&)), TQT_SLOT (slotActivated(const TQString&)));
vbox->addWidget (hbox);
// Read-only combobox
hbox = new TQHBox(this);
hbox->setSpacing (KDialog::spacingHint());
lbl = new TQLabel("&Read-Only Combo:", hbox);
lbl->setSizePolicy (TQSizePolicy::Maximum, TQSizePolicy::Preferred);
m_ro = new KComboBox(hbox, "ReadOnlyCombo" );
lbl->setBuddy (m_ro);
m_ro->setCompletionMode( TDEGlobalSettings::CompletionAuto );
TQObject::connect (m_ro, TQT_SIGNAL(activated(int)), TQT_SLOT(slotActivated(int)));
TQObject::connect (m_ro, TQT_SIGNAL(activated(const TQString&)), TQT_SLOT (slotActivated(const TQString&)));
vbox->addWidget (hbox);
// Read-write combobox
hbox = new TQHBox(this);
hbox->setSpacing (KDialog::spacingHint());
lbl = new TQLabel("&Editable Combo:", hbox);
lbl->setSizePolicy (TQSizePolicy::Maximum, TQSizePolicy::Preferred);
m_rw = new KComboBox( true, hbox, "ReadWriteCombo" );
lbl->setBuddy (m_rw);
m_rw->setDuplicatesEnabled( true );
m_rw->setInsertionPolicy( TQComboBox::NoInsertion );
m_rw->setTrapReturnKey( true );
TQObject::connect (m_rw, TQT_SIGNAL(activated(int)), TQT_SLOT(slotActivated(int)));
TQObject::connect (m_rw, TQT_SIGNAL(activated(const TQString&)), TQT_SLOT(slotActivated(const TQString&)));
TQObject::connect (m_rw, TQT_SIGNAL(returnPressed()), TQT_SLOT(slotReturnPressed()));
TQObject::connect (m_rw, TQT_SIGNAL(returnPressed(const TQString&)), TQT_SLOT(slotReturnPressed(const TQString&)));
vbox->addWidget (hbox);
// History combobox...
hbox = new TQHBox(this);
hbox->setSpacing (KDialog::spacingHint());
lbl = new TQLabel("&History Combo:", hbox);
lbl->setSizePolicy (TQSizePolicy::Maximum, TQSizePolicy::Preferred);
m_hc = new KHistoryCombo( true, hbox, "HistoryCombo" );
lbl->setBuddy (m_hc);
m_hc->setDuplicatesEnabled( true );
m_hc->setInsertionPolicy( TQComboBox::NoInsertion );
TQObject::connect (m_hc, TQT_SIGNAL(activated(int)), TQT_SLOT(slotActivated(int)));
TQObject::connect (m_hc, TQT_SIGNAL(activated(const TQString&)), TQT_SLOT(slotActivated(const TQString&)));
TQObject::connect (m_hc, TQT_SIGNAL(returnPressed()), TQT_SLOT(slotReturnPressed()));
vbox->addWidget (hbox);
m_hc->setTrapReturnKey(true);
// Read-write combobox that is a replica of code in konqueror...
hbox = new TQHBox(this);
hbox->setSpacing (KDialog::spacingHint());
lbl = new TQLabel( "&Konq's Combo:", hbox);
lbl->setSizePolicy (TQSizePolicy::Maximum, TQSizePolicy::Preferred);
m_konqc = new KComboBox( true, hbox, "KonqyCombo" );
lbl->setBuddy (m_konqc);
m_konqc->setMaxCount( 10 );
TQObject::connect (m_konqc, TQT_SIGNAL(activated(int)), TQT_SLOT(slotActivated(int)));
TQObject::connect (m_konqc, TQT_SIGNAL(activated(const TQString&)), TQT_SLOT (slotActivated(const TQString&)));
TQObject::connect (m_konqc, TQT_SIGNAL(returnPressed()), TQT_SLOT(slotReturnPressed()));
vbox->addWidget (hbox);
// Create an exit button
hbox = new TQHBox (this);
m_btnExit = new TQPushButton( "E&xit", hbox );
TQObject::connect( m_btnExit, TQT_SIGNAL(clicked()), TQT_SLOT(quitApp()) );
// Create a disable button...
m_btnEnable = new TQPushButton( "Disa&ble", hbox );
TQObject::connect (m_btnEnable, TQT_SIGNAL(clicked()), TQT_SLOT(slotDisable()));
vbox->addWidget (hbox);
// Popuplate the select-only list box
TQStringList list;
list << "Stone" << "Tree" << "Peables" << "Ocean" << "Sand" << "Chips"
<< "Computer" << "Mankind";
list.sort();
//.........这里部分代码省略.........