本文整理汇总了C++中KLineEdit::setReadOnly方法的典型用法代码示例。如果您正苦于以下问题:C++ KLineEdit::setReadOnly方法的具体用法?C++ KLineEdit::setReadOnly怎么用?C++ KLineEdit::setReadOnly使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KLineEdit
的用法示例。
在下文中一共展示了KLineEdit::setReadOnly方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setWidgetReadOnly
void setWidgetReadOnly(QWidget *w, bool isReadOnly) {
if (m_singleLineEditText == w)
m_singleLineEditText->setReadOnly(isReadOnly);
else if (m_multiLineEditText == w)
m_multiLineEditText->setReadOnly(isReadOnly);
else if (!w->property("isConst").isValid() && !w->property("isConst").toBool())
w->setEnabled(!isReadOnly);
}
示例2: setupGUI
void setupGUI()
{
QBoxLayout *layout = new QVBoxLayout(p);
tabWidget = new QTabWidget(p);
layout->addWidget(tabWidget);
QWidget *container = new QWidget(tabWidget);
tabWidget->addTab(container, QIcon::fromTheme(QStringLiteral("preferences-web-browser-identification")), i18n("Library"));
connect(tabWidget, &QTabWidget::currentChanged, p, &ZoteroBrowser::tabChanged);
QBoxLayout *containerLayout = new QVBoxLayout(container);
/// Personal or Group Library
QGridLayout *gridLayout = new QGridLayout();
containerLayout->addLayout(gridLayout);
gridLayout->setMargin(0);
gridLayout->setColumnMinimumWidth(0, 16); // TODO determine size of a radio button
radioPersonalLibrary = new QRadioButton(i18n("Personal library"), container);
gridLayout->addWidget(radioPersonalLibrary, 0, 0, 1, 2);
radioGroupLibrary = new QRadioButton(i18n("Group library"), container);
gridLayout->addWidget(radioGroupLibrary, 1, 0, 1, 2);
comboBoxGroupList = new KComboBox(false, container);
gridLayout->addWidget(comboBoxGroupList, 2, 1, 1, 1);
QSizePolicy sizePolicy = comboBoxGroupList->sizePolicy();
sizePolicy.setHorizontalPolicy(QSizePolicy::MinimumExpanding);
comboBoxGroupList->setSizePolicy(sizePolicy);
radioPersonalLibrary->setChecked(true);
comboBoxGroupList->setEnabled(false);
comboBoxGroupList->addItem(i18n("No groups available"));
connect(radioGroupLibrary, &QRadioButton::toggled, p, &ZoteroBrowser::radioButtonsToggled);
connect(radioPersonalLibrary, &QRadioButton::toggled, p, &ZoteroBrowser::radioButtonsToggled);
connect(comboBoxGroupList, static_cast<void (KComboBox::*)(int)>(&KComboBox::currentIndexChanged), p, &ZoteroBrowser::groupListChanged);
containerLayout->addStretch(10);
/// Credentials
QFormLayout *containerForm = new QFormLayout();
containerLayout->addLayout(containerForm, 1);
containerForm->setMargin(0);
lineEditNumericUserId = new KLineEdit(container);
lineEditNumericUserId->setSizePolicy(sizePolicy);
lineEditNumericUserId->setReadOnly(true);
containerForm->addRow(i18n("Numeric user id:"), lineEditNumericUserId);
connect(lineEditNumericUserId, &KLineEdit::textChanged, p, &ZoteroBrowser::invalidateGroupList);
lineEditApiKey = new KLineEdit(container);
lineEditApiKey->setSizePolicy(sizePolicy);
lineEditApiKey->setReadOnly(true);
containerForm->addRow(i18n("API key:"), lineEditApiKey);
connect(lineEditApiKey, &KLineEdit::textChanged, p, &ZoteroBrowser::invalidateGroupList);
QBoxLayout *containerButtonLayout = new QHBoxLayout();
containerLayout->addLayout(containerButtonLayout, 0);
containerButtonLayout->setMargin(0);
QPushButton *buttonGetOAuthCredentials = new QPushButton(QIcon::fromTheme(QStringLiteral("preferences-web-browser-identification")), i18n("Get New Credentials"), container);
containerButtonLayout->addWidget(buttonGetOAuthCredentials, 0);
connect(buttonGetOAuthCredentials, &QPushButton::clicked, p, &ZoteroBrowser::getOAuthCredentials);
containerButtonLayout->addStretch(1);
/// Collection browser
collectionBrowser = new QTreeView(tabWidget);
tabWidget->addTab(collectionBrowser, QIcon::fromTheme(QStringLiteral("folder-yellow")), i18n("Collections"));
collectionBrowser->setHeaderHidden(true);
collectionBrowser->setExpandsOnDoubleClick(false);
connect(collectionBrowser, &QTreeView::doubleClicked, p, &ZoteroBrowser::collectionDoubleClicked);
/// Tag browser
tagBrowser = new QListView(tabWidget);
tabWidget->addTab(tagBrowser, QIcon::fromTheme(QStringLiteral("mail-tagged")), i18n("Tags"));
connect(tagBrowser, &QListView::doubleClicked, p, &ZoteroBrowser::tagDoubleClicked);
}
示例3: KDialogBase
DialogCreateTag::DialogCreateTag(QWidget *parent, TagTreeNode* parentNode, const char *name)
: KDialogBase(parent, name, true, "", KDialogBase::Ok|KDialogBase::Cancel, KDialogBase::Ok, false )
, m_parentNode(parentNode) {
if (parentNode) {
this->setCaption(i18n("Create tag"));
} else {
this->setCaption(i18n("Create toplevel tag"));
}
QWidget* mainPanel = new QWidget(this, "mainPanel");
setMainWidget(mainPanel);
QVBoxLayout* mainPanelLayout = new QVBoxLayout(mainPanel, 0, 5, "mainPanelLayout");
mainPanelLayout->setAutoAdd(true);
// parent
if (parentNode) {
// newTagGroup
QGroupBox* parentTagGroup = new QGroupBox(i18n("Parent tag"), mainPanel, "parentTagGroup");
QGridLayout* parentTagGroupLayout = new QGridLayout(parentTagGroup, 4, 4, 20, 5, "parentTagGroupLayout");
parentTagGroupLayout->setRowSpacing(0, 10);
// type
QLabel* typeLabel = new QLabel(i18n("Type"), parentTagGroup, "typeLabel");
parentTagGroupLayout->addWidget(typeLabel, 1, 0);
KComboBox* typeComboBox = new KComboBox(false, parentTagGroup, "typeComboBox");
typeComboBox->insertItem(parentNode->tagNode()->typeName());
typeComboBox->setEnabled(false);
parentTagGroupLayout->addMultiCellWidget(typeComboBox, 1, 1, 1, 2);
// name
QLabel* nameLabel = new QLabel(i18n("Name"), parentTagGroup, "nameLabel");
parentTagGroupLayout->addWidget(nameLabel, 2, 0);
KLineEdit* nameLineEdit = new KLineEdit(parentTagGroup, "nameLineEdit");
nameLineEdit->setText(*parentNode->tagNode()->text());
nameLineEdit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
nameLineEdit->setReadOnly(true);
parentTagGroupLayout->addMultiCellWidget(nameLineEdit, 2, 2, 1, 2);
// icon
QLabel* iconLabel = new QLabel(i18n("Icon"), parentTagGroup, "iconLabel");
parentTagGroupLayout->addWidget(iconLabel, 3, 0);
KLineEdit* iconLineEdit = new KLineEdit(parentTagGroup, "iconLineEdit");
iconLineEdit->setText(*parentNode->tagNode()->iconName());
iconLineEdit->setMinimumWidth(300);
iconLineEdit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
iconLineEdit->setReadOnly(true);
parentTagGroupLayout->addWidget(iconLineEdit, 3, 1);
QPushButton* iconButton = new QPushButton(i18n("Icon"), parentTagGroup, "iconButton");
QIconSet iconSet = KGlobal::iconLoader()->loadIconSet(iconLineEdit->text(), KIcon::Small, Configuration::getInstance()->tagtreeIconSize(), true);
iconButton->setIconSet(iconSet);
iconButton->setText(QString::null);
iconButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
iconButton->setEnabled(true);
parentTagGroupLayout->addWidget(iconButton, 3, 2);
}
// newTagGroup
QGroupBox* newTagGroup = new QGroupBox(i18n("New tag"), mainPanel, "newTagGroup");
QGridLayout* newTagGroupLayout = new QGridLayout(newTagGroup, 4, 4, 20, 5, "newTagGroupLayout");
newTagGroupLayout->setRowSpacing(0, 10);
// type
QLabel* typeLabel = new QLabel(i18n("Type"), newTagGroup, "typeLabel");
newTagGroupLayout->addWidget(typeLabel, 1, 0);
m_typeComboBox = new KComboBox(false, newTagGroup, "typeComboBox");
m_typeComboBoxEntries = new QValueList<int>;
if (!parentNode) {
m_typeComboBox->insertItem(TagNode::tagNodeTypeName(TagNode::TYPE_TITLE));
m_typeComboBoxEntries->append(TagNode::tagNodeTypeId(TagNode::TYPE_TITLE));
}
m_typeComboBox->insertItem(TagNode::tagNodeTypeName(TagNode::TYPE_BOOLEAN));
m_typeComboBoxEntries->append(TagNode::tagNodeTypeId(TagNode::TYPE_BOOLEAN));
newTagGroupLayout->addMultiCellWidget(m_typeComboBox, 1, 1, 1, 2);
// name
QLabel* nameLabel = new QLabel(i18n("Name"), newTagGroup, "nameLabel");
newTagGroupLayout->addWidget(nameLabel, 2, 0);
m_nameLineEdit = new KLineEdit(newTagGroup, "nameLineEdit");
m_nameLineEdit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
QObject::connect(m_nameLineEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotNameChanged(const QString&)));
newTagGroupLayout->addMultiCellWidget(m_nameLineEdit, 2, 2, 1, 2);
// icon
QLabel* iconLabel = new QLabel(i18n("Icon"), newTagGroup, "iconLabel");
newTagGroupLayout->addWidget(iconLabel, 3, 0);
m_iconLineEdit = new KLineEdit(newTagGroup, "iconLineEdit");
m_iconLineEdit->setMinimumWidth(300);
m_iconLineEdit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
QObject::connect(m_iconLineEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotIconTextChanged(const QString&)));
newTagGroupLayout->addWidget(m_iconLineEdit, 3, 1);
//.........这里部分代码省略.........
示例4: setupGUI
void setupGUI() {
QBoxLayout *layout = new QVBoxLayout(p);
labelGreeting = new QLabel(p);
layout->addWidget(labelGreeting);
labelGreeting->setWordWrap(true);
lineEditSourceUrl = new KLineEdit(p);
layout->addWidget(lineEditSourceUrl);
lineEditSourceUrl->setReadOnly(true);
layout->addSpacing(8);
QLabel *label = new QLabel(i18n("The following operations can be performed when associating the document with the entry:"), p);
layout->addWidget(label);
label->setWordWrap(true);
QGroupBox *groupBox = new QGroupBox(i18n("File operation"), p);
layout->addWidget(groupBox);
QBoxLayout *groupBoxLayout = new QVBoxLayout(groupBox);
QButtonGroup *buttonGroup = new QButtonGroup(groupBox);
radioNoCopyMove = new QRadioButton(i18n("Do not copy or move document, only insert reference to it"), groupBox);
groupBoxLayout->addWidget(radioNoCopyMove);
buttonGroup->addButton(radioNoCopyMove);
radioCopyFile = new QRadioButton(i18n("Copy document next to bibliography file"), groupBox);
groupBoxLayout->addWidget(radioCopyFile);
buttonGroup->addButton(radioCopyFile);
radioMoveFile = new QRadioButton(i18n("Move document next to bibliography file"), groupBox);
groupBoxLayout->addWidget(radioMoveFile);
buttonGroup->addButton(radioMoveFile);
connect(buttonGroup, static_cast<void(QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), p, &AssociatedFilesUI::updateUIandPreview);
radioNoCopyMove->setChecked(true); /// by default
groupBoxLayout->addSpacing(4);
labelMoveCopyLocation = new QLabel(i18n("Path and filename of bibliography file:"), groupBox);
groupBoxLayout->addWidget(labelMoveCopyLocation, 1);
lineMoveCopyLocation = new KLineEdit(groupBox);
lineMoveCopyLocation->setReadOnly(true);
groupBoxLayout->addWidget(lineMoveCopyLocation, 1);
groupBoxRename = new QGroupBox(i18n("Rename Document?"), p);
layout->addWidget(groupBoxRename);
QGridLayout *gridLayout = new QGridLayout(groupBoxRename);
gridLayout->setColumnMinimumWidth(0, 16);
gridLayout->setColumnStretch(0, 0);
gridLayout->setColumnStretch(1, 1);
buttonGroup = new QButtonGroup(groupBoxRename);
radioKeepFilename = new QRadioButton(i18n("Keep document's original filename"), groupBoxRename);
gridLayout->addWidget(radioKeepFilename, 0, 0, 1, 2);
buttonGroup->addButton(radioKeepFilename);
radioRenameToEntryId = new QRadioButton(groupBoxRename);
gridLayout->addWidget(radioRenameToEntryId, 1, 0, 1, 2);
buttonGroup->addButton(radioRenameToEntryId);
radioUserDefinedName = new QRadioButton(i18n("User-defined name:"), groupBoxRename);
gridLayout->addWidget(radioUserDefinedName, 2, 0, 1, 2);
buttonGroup->addButton(radioUserDefinedName);
lineEditUserDefinedName = new KLineEdit(groupBoxRename);
gridLayout->addWidget(lineEditUserDefinedName, 3, 1, 1, 1);
connect(lineEditUserDefinedName, &KLineEdit::textEdited, p, &AssociatedFilesUI::updateUIandPreview);
connect(buttonGroup, static_cast<void(QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), p, &AssociatedFilesUI::updateUIandPreview);
radioRenameToEntryId->setChecked(true); /// by default
groupBoxPathType = new QGroupBox(i18n("Path as Inserted into Entry"), p);
buttonGroup = new QButtonGroup(groupBoxPathType);
layout->addWidget(groupBoxPathType);
groupBoxLayout = new QVBoxLayout(groupBoxPathType);
radioRelativePath = new QRadioButton(i18n("Relative Path"), groupBoxPathType);
groupBoxLayout->addWidget(radioRelativePath);
buttonGroup->addButton(radioRelativePath);
radioAbsolutePath = new QRadioButton(i18n("Absolute Path"), groupBoxPathType);
groupBoxLayout->addWidget(radioAbsolutePath);
buttonGroup->addButton(radioAbsolutePath);
connect(buttonGroup, static_cast<void(QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), p, &AssociatedFilesUI::updateUIandPreview);
radioRelativePath->setChecked(true); /// by default
layout->addSpacing(8);
label = new QLabel(i18n("Preview of reference to be inserted:"), p);
layout->addWidget(label);
linePreview = new KLineEdit(p);
layout->addWidget(linePreview);
linePreview->setReadOnly(true);
layout->addStretch(10);
}