本文整理汇总了C++中KComboBox::setObjectName方法的典型用法代码示例。如果您正苦于以下问题:C++ KComboBox::setObjectName方法的具体用法?C++ KComboBox::setObjectName怎么用?C++ KComboBox::setObjectName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KComboBox
的用法示例。
在下文中一共展示了KComboBox::setObjectName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QVBoxLayout
//
// FreeBSD and NetBSD
//
void Smb4KConfigPageMounting::setupWidget()
{
QVBoxLayout *mount_layout = new QVBoxLayout(this);
mount_layout->setSpacing(5);
mount_layout->setMargin(0);
// Common Options
QGroupBox *common_options = new QGroupBox(i18n("Common Options"), this);
QGridLayout *common_layout = new QGridLayout(common_options);
common_layout->setSpacing(5);
QLabel *user_id_label = new QLabel(Smb4KMountSettings::self()->userIDItem()->label(), common_options);
QWidget *user_widget = new QWidget(common_options);
QGridLayout *user_layout = new QGridLayout(user_widget);
user_layout->setSpacing(5);
user_layout->setMargin(0);
KLineEdit *user_id = new KLineEdit(user_widget);
user_id->setObjectName("kcfg_UserID");
user_id->setAlignment(Qt::AlignRight);
user_id->setReadOnly(true);
QToolButton *user_chooser = new QToolButton(user_widget);
user_chooser->setIcon(KDE::icon("edit-find-user"));
user_chooser->setToolTip(i18n("Choose a different user"));
user_chooser->setPopupMode(QToolButton::InstantPopup);
user_id_label->setBuddy(user_chooser);
QMenu *user_menu = new QMenu(user_chooser);
user_chooser->setMenu(user_menu);
QList<KUser> user_list = KUser::allUsers();
QMap<QString,QString> users;
for (int i = 0; i < user_list.size(); ++i)
{
users.insert(QString("%1 (%2)").arg(user_list.at(i).loginName()).arg(user_list.at(i).userId().nativeId()),
QString("%1").arg(user_list.at(i).userId().nativeId()));
}
QMap<QString,QString>::const_iterator u_it = users.constBegin();
while (u_it != users.constEnd())
{
QAction *user_action = user_menu->addAction(u_it.key());
user_action->setData(u_it.value());
++u_it;
}
user_layout->addWidget(user_id, 0, 0, 0);
user_layout->addWidget(user_chooser, 0, 1, Qt::AlignCenter);
QLabel *group_id_label = new QLabel(Smb4KMountSettings::self()->groupIDItem()->label(), common_options);
QWidget *group_widget = new QWidget(common_options);
QGridLayout *group_layout = new QGridLayout(group_widget);
group_layout->setSpacing(5);
group_layout->setMargin(0);
KLineEdit *group_id = new KLineEdit(group_widget);
group_id->setObjectName("kcfg_GroupID");
group_id->setAlignment(Qt::AlignRight);
group_id->setReadOnly(true);
QToolButton *group_chooser = new QToolButton(group_widget);
group_chooser->setIcon(KDE::icon("edit-find-user"));
group_chooser->setToolTip(i18n("Choose a different group"));
group_chooser->setPopupMode(QToolButton::InstantPopup);
group_id_label->setBuddy(group_chooser);
QMenu *group_menu = new QMenu(group_chooser);
group_chooser->setMenu(group_menu);
QList<KUserGroup> group_list = KUserGroup::allGroups();
QMap<QString,QString> groups;
for (int i = 0; i < group_list.size(); ++i)
{
groups.insert(QString("%1 (%2)").arg(group_list.at(i).name()).arg(group_list.at(i).groupId().nativeId()),
QString("%1").arg(group_list.at(i).groupId().nativeId()));
}
QMap<QString,QString>::const_iterator g_it = groups.constBegin();
while (g_it != groups.constEnd())
{
QAction *group_action = group_menu->addAction(g_it.key());
group_action->setData(g_it.value());
++g_it;
}
//.........这里部分代码省略.........
示例2: if
/*
InputDialog
*/
InputDialog::InputDialog(const QString &caption, uint options, const QStringList& history, const QString& hint, const QString& alter, KileInfo *ki, QWidget *parent, const char *name)
: KDialog (parent), m_ki(ki)
{
setModal(true);
setButtons(Ok | Cancel);
setDefaultButton(Ok);
showButtonSeparator(true);
setObjectName(name);
QString newcaption = caption;
setCaption(newcaption.remove('&'));
m_labelprefix = ( newcaption == "chapter" ) ? "chap:" : "sec:";
m_usedSelection = false;
QWidget *page = new QWidget(this);
setMainWidget(page);
QGridLayout *gbox = new QGridLayout(page);
QLabel *lb = new QLabel(hint, page);
gbox->addWidget(lb, 0, 0, 1, 3);
m_tag.clear();
QWidget *focus;
if((options & KileAction::KeepHistory) || (options & KileAction::FromLabelList) || (options & KileAction::FromBibItemList)) {
KComboBox *input = new KComboBox(true, page);
input->setObjectName("input_dialog_input");
input->setCompletionMode(KGlobalSettings::CompletionAuto);
input->setMinimumWidth(300);
focus = input;
connect(input, SIGNAL(textChanged(const QString&)), this, SLOT(setTag(const QString&)));
connect(this, SIGNAL(setInput(const QString&)), input, SLOT(setEditText(const QString&)));
if(options & KileAction::ShowBrowseButton) {
gbox->addWidget(input, 1, 0);
}
else {
gbox->addWidget(input, 1, 0, 1, 3);
}
QStringList list;
if(options & KileAction::FromLabelList) {
list = ki->allLabels();
if(list.size() > 0) {
input->addItems(list);
m_tag = list.first();
}
}
else if(options & KileAction::FromBibItemList) {
list = ki->allBibItems();
if(list.size() > 0) {
input->addItems(list);
m_tag = list.first();
}
}
else {
if(history.size() > 0){
input->addItems(history);
m_tag = history.first();
}
}
}