本文整理汇总了C++中KLineEdit::setAlignment方法的典型用法代码示例。如果您正苦于以下问题:C++ KLineEdit::setAlignment方法的具体用法?C++ KLineEdit::setAlignment怎么用?C++ KLineEdit::setAlignment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KLineEdit
的用法示例。
在下文中一共展示了KLineEdit::setAlignment方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QVBoxLayout
//
// Linux
//
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;
}
//.........这里部分代码省略.........