本文整理汇总了C++中KPageWidgetItem类的典型用法代码示例。如果您正苦于以下问题:C++ KPageWidgetItem类的具体用法?C++ KPageWidgetItem怎么用?C++ KPageWidgetItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了KPageWidgetItem类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: currentPage
QString FormAssistant::currentPage() const
{
KPageWidgetItem* item = KPageDialog::currentPage();
return item ? item->name() : QString();
}
示例2: KPageDialog
KoDocumentInfoDlg::KoDocumentInfoDlg(QWidget* parent, KoDocumentInfo* docInfo, KoDocumentRdf* docRdf)
: KPageDialog(parent)
, d(new KoDocumentInfoDlgPrivate)
{
d->m_info = docInfo;
d->m_rdf = docRdf;
setCaption(i18n("Document Information"));
setInitialSize(QSize(500, 500));
setFaceType(KPageDialog::List);
setButtons(KDialog::Ok | KDialog::Cancel);
setDefaultButton(KDialog::Ok);
d->m_aboutUi = new Ui::KoDocumentInfoAboutWidget();
QWidget *infodlg = new QWidget();
d->m_aboutUi->setupUi(infodlg);
if (!KoEncryptionChecker::isEncryptionSupported()) {
d->m_aboutUi->lblEncryptedDesc->setVisible(false);
d->m_aboutUi->lblEncrypted->setVisible(false);
d->m_aboutUi->pbEncrypt->setVisible(false);
d->m_aboutUi->lblEncryptedPic->setVisible(false);
}
KPageWidgetItem *page = new KPageWidgetItem(infodlg, i18n("General"));
page->setHeader(i18n("General"));
// Ugly hack, the mimetype should be a parameter, instead
KoDocument* doc = dynamic_cast< KoDocument* >(d->m_info->parent());
if (doc) {
KMimeType::Ptr mime = KMimeType::mimeType(doc->mimeType());
if (! mime)
mime = KMimeType::defaultMimeTypePtr();
page->setIcon(KIcon(KIconLoader::global()->loadMimeTypeIcon(mime->iconName(), KIconLoader::Desktop, 48)));
}
addPage(page);
d->m_pages.append(page);
initAboutTab();
d->m_authorUi = new Ui::KoDocumentInfoAuthorWidget();
QWidget *authordlg = new QWidget();
d->m_authorUi->setupUi(authordlg);
page = new KPageWidgetItem(authordlg, i18n("Author"));
page->setHeader(i18n("Author"));
page->setIcon(KIcon("user-identity"));
addPage(page);
d->m_pages.append(page);
initAuthorTab();
// Saving encryption implies saving the document, this is done after closing the dialog
connect(this, SIGNAL(hidden()), this, SLOT(slotSaveEncryption()));
if (d->m_rdf) {
d->m_rdfEditWidget = 0;
#ifdef SHOULD_BUILD_RDF
d->m_rdfEditWidget = new KoDocumentRdfEditWidget(this, d->m_rdf);
page = new KPageWidgetItem(d->m_rdfEditWidget->widget(), i18n("Rdf"));
page->setHeader(i18n("Rdf"));
page->setIcon(KIcon("text-rdf"));
addPage(page);
d->m_pages.append(page);
#endif
}
}
示例3: ConfigDialog
KonviSettingsDialog::KonviSettingsDialog( QWidget *parent) :
ConfigDialog( parent, QLatin1String("settings"), Preferences::self())
{
setFaceType(KPageDialog::Tree);
m_modified = false;
KPageWidgetItem* interfaceGroup = new KPageWidgetItem(new QWidget(this), i18n("Interface"));
interfaceGroup->setIcon(QIcon::fromTheme("preferences-desktop-theme"));
KPageDialog::addPage(interfaceGroup);
KPageWidgetItem* behaviorGroup = new KPageWidgetItem(new QWidget(this), i18n("Behavior"));
behaviorGroup->setIcon(QIcon::fromTheme("configure"));
KPageDialog::addPage(behaviorGroup);
KPageWidgetItem* notificationGroup = new KPageWidgetItem(new QWidget(this), i18n("Notifications"));
notificationGroup->setIcon(QIcon::fromTheme("preferences-desktop-notification"));
KPageDialog::addPage(notificationGroup);
QWidget *w = 0;
//Interface/Chat Window
Ui::ChatWindowAppearance_Config confChatWindowAppearance;
w = new QWidget();
confChatWindowAppearance.setupUi(w);
confChatWindowAppearance.kcfg_TimestampFormat->addItem("hh:mm");
confChatWindowAppearance.kcfg_TimestampFormat->addItem("hh:mm:ss");
confChatWindowAppearance.kcfg_TimestampFormat->addItem("h:m ap");
konviAddSubPage(interfaceGroup, w, i18n("Chat Window"), QLatin1String("view-list-text"));
//Interface/Themes
m_confThemeWdg = new Theme_Config( this, "Theme" );
konviAddSubPage(interfaceGroup, m_confThemeWdg, i18n("Nicklist Themes"), QLatin1String("preferences-desktop-icons"));
m_pages.append(m_confThemeWdg);
connect(m_confThemeWdg, &Theme_Config::modified, this, &KonviSettingsDialog::modifiedSlot);
//Interface/Colors
Ui::ColorsAppearance_Config confColorsAppearance;
w = new QWidget();
confColorsAppearance.setupUi(w);
konviAddSubPage(interfaceGroup, w, i18n("Colors"), QLatin1String("preferences-desktop-color"));
//Interface/Fonts
Ui::FontAppearance_Config confFontAppearance;
w = new QWidget();
confFontAppearance.setupUi(w);
konviAddSubPage(interfaceGroup, w, i18n("Fonts"), QLatin1String("preferences-desktop-font"));
//Interface/Quick Buttons
m_confQuickButtonsWdg = new QuickButtons_Config( this, "QuickButtons" );
konviAddSubPage(interfaceGroup, m_confQuickButtonsWdg, i18n("Quick Buttons"), QLatin1String("preferences-desktop-keyboard"));
m_pages.append(m_confQuickButtonsWdg);
connect(m_confQuickButtonsWdg, &QuickButtons_Config::modified, this, &KonviSettingsDialog::modifiedSlot);
//Interface/Tabs
m_confTabBarWdg = new Tabs_Config( this, "TabBar" );
konviAddSubPage(interfaceGroup, m_confTabBarWdg, i18n("Tabs"), QLatin1String("tab-new"));
//Behavior/General
Ui::GeneralBehavior_ConfigUI confGeneralBehavior;
w = new QWidget();
confGeneralBehavior.setupUi(w);
konviAddSubPage(behaviorGroup, w, i18n("General Behavior"), QLatin1String("configure"));
//Behavior/Connection
ConnectionBehavior_Config* confConnectionBehavior = new ConnectionBehavior_Config(this);
confConnectionBehavior->setObjectName("ConnectionBehavior");
konviAddSubPage(behaviorGroup, confConnectionBehavior, i18n("Connection"), QLatin1String("network-connect"));
m_pages.append(confConnectionBehavior);
//Behaviour/Chat Window
Ui::ChatwindowBehaviour_Config confChatwindowBehaviour;
w = new QWidget();
confChatwindowBehaviour.setupUi(w);
confChatwindowBehaviour.kcfg_ScrollbackMax->setSuffix(ki18np(" line", " lines"));
confChatwindowBehaviour.kcfg_AutoWhoNicksLimit->setSuffix(ki18np(" nick", " nicks"));
confChatwindowBehaviour.kcfg_AutoWhoContinuousInterval->setSuffix(ki18np(" second", " seconds"));
konviAddSubPage(behaviorGroup, w, i18n("Chat Window"), QLatin1String("view-list-text"));
//Behaviour/Nickname List
m_confNicklistBehaviorWdg = new NicklistBehavior_Config( this, "NicklistBehavior" );
konviAddSubPage(behaviorGroup, m_confNicklistBehaviorWdg, i18n("Nickname List"), QLatin1String("preferences-contact-list"));
connect(m_confNicklistBehaviorWdg, &NicklistBehavior_Config::modified, this, &KonviSettingsDialog::modifiedSlot);
m_pages.append(m_confNicklistBehaviorWdg);
//Behaviour/Command Aliases
m_confAliasWdg = new Alias_Config( this, "Alias" );
konviAddSubPage(behaviorGroup, m_confAliasWdg, i18n("Command Aliases"), QLatin1String("edit-rename"));
m_pages.append(m_confAliasWdg);
connect(m_confAliasWdg, &Alias_Config::modified, this, &KonviSettingsDialog::modifiedSlot);
//Behaviour/Auto Replace
m_confAutoreplaceWdg = new Autoreplace_Config( this, "Autoreplace" );
konviAddSubPage(behaviorGroup, m_confAutoreplaceWdg, i18n("Auto Replace"), QLatin1String("edit-rename"));
m_pages.append(m_confAutoreplaceWdg);
connect(m_confAutoreplaceWdg, &Autoreplace_Config::modified, this, &KonviSettingsDialog::modifiedSlot);
//Behaviour/Ignore
m_confIgnoreWdg = new Ignore_Config(this, "Ignore");
konviAddSubPage(behaviorGroup, m_confIgnoreWdg, i18nc("@title:tab", "Ignore"), QLatin1String("process-stop"));
//.........这里部分代码省略.........
示例4: QWidget
KPageWidgetTest::KPageWidgetTest( QWidget *parent )
: QWidget( parent )
{
QGridLayout *layout = new QGridLayout( this );
mWidget = new KPageWidget( this );
layout->addWidget( mWidget, 0, 0, 7, 1 );
connect( mWidget, SIGNAL( currentPageChanged( KPageWidgetItem*, KPageWidgetItem* ) ),
this, SLOT( currentPageChanged( KPageWidgetItem*, KPageWidgetItem* ) ) );
connect( mWidget, SIGNAL( pageToggled( KPageWidgetItem*, bool ) ),
this, SLOT( pageToggled( KPageWidgetItem*, bool ) ) );
int rowCount = 0;
QPushButton *button = new QPushButton( "Auto", this );
layout->addWidget( button, rowCount, 1 );
connect( button, SIGNAL( clicked() ), this, SLOT( setAutoFace() ) );
rowCount++;
button = new QPushButton( "Plain", this );
layout->addWidget( button, rowCount, 1 );
connect( button, SIGNAL( clicked() ), this, SLOT( setPlainFace() ) );
rowCount++;
button = new QPushButton( "List", this );
layout->addWidget( button, rowCount, 1 );
connect( button, SIGNAL( clicked() ), this, SLOT( setListFace() ) );
rowCount++;
button = new QPushButton( "Tree", this );
layout->addWidget( button, rowCount, 1 );
connect( button, SIGNAL( clicked() ), this, SLOT( setTreeFace() ) );
rowCount++;
button = new QPushButton( "Tabbed", this );
layout->addWidget( button, rowCount, 1 );
connect( button, SIGNAL( clicked() ), this, SLOT( setTabbedFace() ) );
rowCount++;
button = new QPushButton( "Add Page", this );
layout->addWidget( button, rowCount, 1 );
connect( button, SIGNAL( clicked() ), this, SLOT( addPage() ) );
rowCount++;
button = new QPushButton( "Add Sub Page", this );
layout->addWidget( button, rowCount, 1 );
connect( button, SIGNAL( clicked() ), this, SLOT( addSubPage() ) );
rowCount++;
button = new QPushButton( "Insert Page", this );
layout->addWidget( button, rowCount, 1 );
connect( button, SIGNAL( clicked() ), this, SLOT( insertPage() ) );
rowCount++;
button = new QPushButton( "Delete Page", this );
layout->addWidget( button, rowCount, 1 );
connect( button, SIGNAL( clicked() ), this, SLOT( deletePage() ) );
rowCount++;
KPageWidgetItem *item = mWidget->addPage( new QPushButton( "folder" ), "folder" );
item->setIcon( KIcon( "folder" ) );
item = mWidget->addSubPage( item, new QPushButton( "subfolder" ), "subfolder" );
item->setIcon( KIcon( "folder" ) );
item = mWidget->addPage( new QLabel( "second folder" ), "second folder" );
item->setIcon( KIcon( "folder" ) );
}
示例5: KPageDialog
ConfigurationDialog::ConfigurationDialog(QWidget *parent) : KPageDialog(parent)
{
setCaption(i18nc("@title:window", "Configure Kaffeine"));
QWidget *widget = new QWidget(this);
QGridLayout *gridLayout = new QGridLayout(widget);
startupDisplayModeBox = new KComboBox(widget);
startupDisplayModeBox->addItem(i18nc("@item:inlistbox 'Startup display mode:'",
"Normal Mode"));
startupDisplayModeBox->addItem(i18nc("@item:inlistbox 'Startup display mode:'",
"Minimal Mode"));
startupDisplayModeBox->addItem(i18nc("@item:inlistbox 'Startup display mode:'",
"Full Screen Mode"));
startupDisplayModeBox->addItem(i18nc("@item:inlistbox 'Startup display mode:'",
"Remember Last Setting"));
startupDisplayModeBox->setCurrentIndex(Configuration::instance()->getStartupDisplayMode());
gridLayout->addWidget(startupDisplayModeBox, 0, 1);
QLabel *label = new QLabel(i18nc("@label:listbox", "Startup display mode:"), widget);
label->setBuddy(startupDisplayModeBox);
gridLayout->addWidget(label, 0, 0);
shortSkipBox = new QSpinBox(widget);
shortSkipBox->setRange(1, 600);
shortSkipBox->setValue(Configuration::instance()->getShortSkipDuration());
gridLayout->addWidget(shortSkipBox, 1, 1);
label = new QLabel(i18nc("@label:spinbox", "Short skip duration:"), widget);
label->setBuddy(shortSkipBox);
gridLayout->addWidget(label, 1, 0);
longSkipBox = new QSpinBox(widget);
longSkipBox->setRange(1, 600);
longSkipBox->setValue(Configuration::instance()->getLongSkipDuration());
gridLayout->addWidget(longSkipBox, 2, 1);
label = new QLabel(i18nc("@label:spinbox", "Long skip duration:"), widget);
label->setBuddy(longSkipBox);
gridLayout->addWidget(label, 2, 0);
gridLayout->setRowStretch(3, 1);
KPageWidgetItem *page = new KPageWidgetItem(widget, i18nc("@title:group", "General"));
page->setIcon(KIcon(QLatin1String("configure")));
addPage(page);
widget = new QWidget(this);
gridLayout = new QGridLayout(widget);
label = new QLabel(i18nc("@label:textbox", "Log messages:"), widget);
gridLayout->addWidget(label, 0, 0);
QPushButton *pushButton = new QPushButton(i18nc("@action:button", "Show dmesg"));
pushButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
connect(pushButton, SIGNAL(clicked()), this, SLOT(showDmesg()));
gridLayout->addWidget(pushButton, 0, 1);
QPlainTextEdit *textEdit = new QPlainTextEdit(widget);
textEdit->setPlainText(Log::getLog());
textEdit->setReadOnly(true);
gridLayout->addWidget(textEdit, 1, 0, 1, 2);
gridLayout->setRowStretch(2, 1);
page = new KPageWidgetItem(widget, i18nc("@title:group", "Diagnostics"));
page->setIcon(KIcon(QLatin1String("page-zoom")));
addPage(page);
}
示例6: KPageDialog
ConfigureDialog::ConfigureDialog(const QString &destName, bool isClass, QWidget *parent) :
KPageDialog(parent)
{
setFaceType(List);
setModal(false);
setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Apply);
setWindowTitle(destName);
setWindowIcon(QIcon::fromTheme("configure"));
enableButtonApply(false);
// Needed so we have our dialog size saved
setAttribute(Qt::WA_DeleteOnClose);
QStringList attr;
KPageWidgetItem *page;
modifyPrinter = new ModifyPrinter(destName, isClass, this);
PrinterBehavior *printerBehavior = new PrinterBehavior(destName, isClass, this);
attr << modifyPrinter->neededValues();
attr << printerBehavior->neededValues();
attr << KCUPS_PRINTER_TYPE; // needed to know if it's a remote printer
attr << KCUPS_PRINTER_MAKE_AND_MODEL;
KCupsPrinter printer;
QPointer<KCupsRequest> request = new KCupsRequest;
request->getPrinterAttributes(destName, isClass, attr);
request->waitTillFinished();
if (!request) {
return;
}
if (!request->hasError() && !request->printers().isEmpty()){
printer = request->printers().first();
}
// qCDebug(PM_CONFIGURE_PRINTER) << "VALUES" << printer.a rgument();
// qCDebug(PM_CONFIGURE_PRINTER) << "marker" << values["marker-levels"].value<QList<int> >();
request->deleteLater();
// qCDebug(PM_CONFIGURE_PRINTER) << values;
if (printer.type() & CUPS_PRINTER_LOCAL) {
qCDebug(PM_CONFIGURE_PRINTER) << "CUPS_PRINTER_LOCAL";
}
isClass = printer.isClass();
bool isRemote = false;
if (printer.type() & CUPS_PRINTER_REMOTE) {
qCDebug(PM_CONFIGURE_PRINTER) << "CUPS_PRINTER_REMOTE";
isRemote = true;
}
if (printer.type() & CUPS_PRINTER_BW) {
qCDebug(PM_CONFIGURE_PRINTER) << "CUPS_PRINTER_BW";
}
if (printer.type() & CUPS_PRINTER_COLOR) {
qCDebug(PM_CONFIGURE_PRINTER) << "CUPS_PRINTER_COLOR";
}
if (printer.type() & CUPS_PRINTER_MFP) {
qCDebug(PM_CONFIGURE_PRINTER) << "CUPS_PRINTER_MFP";
}
modifyPrinter->setRemote(isRemote);
modifyPrinter->setValues(printer);
page = new KPageWidgetItem(modifyPrinter, i18n("Modify Printer"));
page->setHeader(i18n("Configure"));
page->setIcon(QIcon::fromTheme("dialog-information"));
// CONNECT this signal ONLY to the first Page
connect(modifyPrinter, SIGNAL(changed(bool)), this, SLOT(enableButtonApply(bool)));
addPage(page);
if (!isClass) {
// At least on localhost:631 modify printer does not show printer options
// for classes
printerOptions = new PrinterOptions(destName, isClass, isRemote, this);
page = new KPageWidgetItem(printerOptions, i18n("Printer Options"));
page->setHeader(i18n("Set the Default Printer Options"));
page->setIcon(QIcon::fromTheme("view-pim-tasks"));
addPage(page);
connect(modifyPrinter, SIGNAL(ppdChanged()), this, SLOT(ppdChanged()));
modifyPrinter->setCurrentMake(printerOptions->currentMake());
modifyPrinter->setCurrentMakeAndModel(printerOptions->currentMakeAndModel());
}
printerBehavior->setRemote(isRemote);
printerBehavior->setValues(printer);
page = new KPageWidgetItem(printerBehavior, i18n("Banners, Policies and Allowed Users"));
page->setHeader(i18n("Banners, Policies and Allowed Users"));
page->setIcon(QIcon::fromTheme("feed-subscribe"));
addPage(page);
// connect this after ALL pages were added, otherwise the slot will be called
connect(this, SIGNAL(currentPageChanged(KPageWidgetItem*,KPageWidgetItem*)),
SLOT(currentPageChanged(KPageWidgetItem*,KPageWidgetItem*)));
KConfigGroup group(KSharedConfig::openConfig("print-manager"), "ConfigureDialog");
KWindowConfig::restoreWindowSize(windowHandle(), group);
connect(buttonBox(), SIGNAL(clicked(QAbstractButton*)), this, SLOT(slotButtonClicked(QAbstractButton*)));
}
示例7: KPageDialog
PropertiesDialog::PropertiesDialog(QWidget *parent, Okular::Document *doc)
: KPageDialog( parent ), m_document( doc ), m_fontPage( 0 ),
m_fontModel( 0 ), m_fontInfo( 0 ), m_fontProgressBar( 0 ),
m_fontScanStarted( false )
{
setFaceType( Tabbed );
setCaption( i18n( "Unknown File" ) );
setButtons( Ok );
// PROPERTIES
QFrame *page = new QFrame();
KPageWidgetItem *item = addPage( page, i18n( "&Properties" ) );
item->setIcon( KIcon( "document-properties" ) );
// get document info
const Okular::DocumentInfo info = doc->documentInfo();
QFormLayout *layout = new QFormLayout( page );
// mime name based on mimetype id
QString mimeName = info.get( Okular::DocumentInfo::MimeType ).section( '/', -1 ).toUpper();
setCaption( i18n( "%1 Properties", mimeName ) );
int valMaxWidth = 100;
/* obtains the properties list, conveniently ordered */
QStringList orderedProperties;
orderedProperties << Okular::DocumentInfo::getKeyString( Okular::DocumentInfo::FilePath )
<< Okular::DocumentInfo::getKeyString( Okular::DocumentInfo::PagesSize )
<< Okular::DocumentInfo::getKeyString( Okular::DocumentInfo::DocumentSize );
for (Okular::DocumentInfo::Key ks = Okular::DocumentInfo::Title;
ks <= Okular::DocumentInfo::Keywords;
ks = Okular::DocumentInfo::Key( ks+1 ) )
{
orderedProperties << Okular::DocumentInfo::getKeyString( ks );
}
foreach( const QString &ks, info.keys()) {
if ( !orderedProperties.contains( ks ) ) {
orderedProperties << ks;
}
}
for ( QStringList::Iterator it = orderedProperties.begin();
it != orderedProperties.end();
++it )
{
const QString key = *it;
const QString titleString = info.getKeyTitle( key );
const QString valueString = info.get( key );
if ( titleString.isNull() || valueString.isNull() )
continue;
// create labels and layout them
QWidget *value = NULL;
if ( key == Okular::DocumentInfo::getKeyString( Okular::DocumentInfo::MimeType ) ) {
/// for mime type fields, show icon as well
value = new QWidget( page );
/// place icon left of mime type's name
QHBoxLayout *hboxLayout = new QHBoxLayout( value );
hboxLayout->setMargin( 0 );
/// retrieve icon and place it in a QLabel
KMimeType::Ptr mimeType = KMimeType::mimeType( valueString );
KSqueezedTextLabel *squeezed;
if (!mimeType.isNull()) {
/// retrieve icon and place it in a QLabel
QLabel *pixmapLabel = new QLabel( value );
hboxLayout->addWidget( pixmapLabel, 0 );
pixmapLabel->setPixmap( KIconLoader::global()->loadMimeTypeIcon( mimeType->iconName(), KIconLoader::Small ) );
/// mime type's name and label
squeezed = new KSqueezedTextLabel( i18nc( "mimetype information, example: \"PDF Document (application/pdf)\"", "%1 (%2)", mimeType->comment(), valueString ), value );
} else {
/// only mime type name
squeezed = new KSqueezedTextLabel( valueString, value );
}
squeezed->setTextInteractionFlags( Qt::TextSelectableByMouse );
hboxLayout->addWidget( squeezed, 1 );
} else {
/// default for any other document information
KSqueezedTextLabel *label = new KSqueezedTextLabel( valueString, page );
label->setTextInteractionFlags( Qt::TextSelectableByMouse );
value = label;
}
layout->addRow( new QLabel( i18n( "%1:", titleString ) ), value);
// refine maximum width of 'value' labels
valMaxWidth = qMax( valMaxWidth, fontMetrics().width( valueString ) );
}
// FONTS
QVBoxLayout *page2Layout = 0;
if ( doc->canProvideFontInformation() ) {
// create fonts tab and layout it
QFrame *page2 = new QFrame();
m_fontPage = addPage(page2, i18n("&Fonts"));
m_fontPage->setIcon( KIcon( "preferences-desktop-font" ) );
page2Layout = new QVBoxLayout(page2);
page2Layout->setMargin(marginHint());
page2Layout->setSpacing(spacingHint());
// add a tree view
QTreeView *view = new QTreeView(page2);
view->setContextMenuPolicy(Qt::CustomContextMenu);
//.........这里部分代码省略.........