本文整理汇总了C++中QSplitter::sizeHint方法的典型用法代码示例。如果您正苦于以下问题:C++ QSplitter::sizeHint方法的具体用法?C++ QSplitter::sizeHint怎么用?C++ QSplitter::sizeHint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSplitter
的用法示例。
在下文中一共展示了QSplitter::sizeHint方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: KMainWindow
KEBApp::KEBApp(const QString &bookmarksFile, bool readonly, const QString &address, bool browser, const QString &caption)
: KMainWindow(), m_dcopIface(0), m_bookmarksFilename(bookmarksFile), m_caption(caption), m_readOnly(readonly), m_browser(browser)
{
m_cmdHistory = new CmdHistory(actionCollection());
s_topLevel = this;
int h = 20;
QSplitter *vsplitter = new QSplitter(this);
KToolBar *quicksearch = new KToolBar(vsplitter, "search toolbar");
KAction *resetQuickSearch = new KAction(i18n("Reset Quick Search"), QApplication::reverseLayout() ? "clear_left" : "locationbar_erase", 0,
actionCollection(), "reset_quicksearch");
resetQuickSearch->setWhatsThis(
i18n("<b>Reset Quick Search</b><br>"
"Resets the quick search so that all bookmarks are shown again."));
resetQuickSearch->plug(quicksearch);
QLabel *lbl = new QLabel(i18n("Se&arch:"), quicksearch, "kde toolbar widget");
KListViewSearchLine *searchLineEdit = new KEBSearchLine(quicksearch, 0, "KListViewSearchLine");
quicksearch->setStretchableWidget(searchLineEdit);
lbl->setBuddy(searchLineEdit);
connect(resetQuickSearch, SIGNAL(activated()), searchLineEdit, SLOT(clear()));
connect(searchLineEdit, SIGNAL(searchUpdated()), SLOT(updateActions()));
ListView::createListViews(vsplitter);
ListView::self()->initListViews();
searchLineEdit->setListView(static_cast< KListView * >(ListView::self()->widget()));
ListView::self()->setSearchLine(searchLineEdit);
m_bkinfo = new BookmarkInfoWidget(vsplitter);
vsplitter->setOrientation(QSplitter::Vertical);
vsplitter->setSizes(QValueList< int >() << h << 380 << m_bkinfo->sizeHint().height());
setCentralWidget(vsplitter);
resize(ListView::self()->widget()->sizeHint().width(), vsplitter->sizeHint().height());
createActions();
if(m_browser)
createGUI();
else
createGUI("keditbookmarks-genui.rc");
m_dcopIface = new KBookmarkEditorIface();
connect(kapp->clipboard(), SIGNAL(dataChanged()), SLOT(slotClipboardDataChanged()));
ListView::self()->connectSignals();
KGlobal::locale()->insertCatalogue("libkonq");
m_canPaste = false;
construct();
ListView::self()->setCurrent(ListView::self()->getItemAtAddress(address), true);
setCancelFavIconUpdatesEnabled(false);
setCancelTestsEnabled(false);
updateActions();
}
示例2: syntaxList
SyntaxEditorWindow::SyntaxEditorWindow(const QSharedPointer<SyntaxList> &syntaxList, const QString &syntaxName,
const QString &category, const QString &syntaxHint, QWidget *parent) :
QWidget(parent), syntaxList(syntaxList), syntaxName(syntaxName)
{
setWindowRole("kadu-syntax-editor");
setWindowTitle(tr("Kadu syntax editor"));
setAttribute(Qt::WA_DeleteOnClose);
QVBoxLayout *layout = new QVBoxLayout(this);
QSplitter *splitter = new QSplitter(this);
layout->addWidget(splitter);
splitter->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
splitter->setChildrenCollapsible(false);
QWidget *splitterleft = new QWidget(splitter);
QVBoxLayout *splitterleftlayout = new QVBoxLayout(splitterleft);
splitterleftlayout->setMargin(0);
splitterleftlayout->setSpacing(5);
editor = new QTextEdit(this);
splitterleftlayout->addWidget(editor);
editor->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
editor->setAcceptRichText(true);
editor->setPlainText(syntaxList->readSyntax(syntaxName));
QFont font = this->font();
font.setFamily("monospace");
if(font.pixelSize() == -1)
font.setPointSizeF(font.pointSizeF() - 0.5);
else
font.setPixelSize(font.pixelSize() - 2);
editor->setFont(font);
editor->setMinimumSize(EDITOR_MINIMUM_SIZE);
if (!syntaxHint.isEmpty())
{
QLabel *editorhint = new QLabel(this);
splitterleftlayout->addWidget(editorhint);
editorhint->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
editorhint->setWordWrap(true);
editorhint->setText(syntaxHint);
}
QWidget *splitterright = new QWidget(splitter);
QVBoxLayout *splitterrightlayout = new QVBoxLayout(splitterright);
splitterrightlayout->setMargin(0);
splitterrightlayout->setSpacing(5);
previewPanel = new Preview(this);
splitterrightlayout->addWidget(previewPanel);
previewPanel->setMinimumHeight(0);
previewPanel->setMaximumHeight(QWIDGETSIZE_MAX);
previewPanel->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
previewPanel->setResetBackgroundColor(config_file.readEntry("Look", category + "BgColor"));
previewPanel->setMinimumSize(PREVIEW_MINIMUM_SIZE);
QPushButton *previewbutton = new QPushButton(qApp->style()->standardIcon(QStyle::SP_BrowserReload), tr("Refresh Preview"), this);
splitterrightlayout->addWidget(previewbutton);
connect(previewbutton, SIGNAL(clicked()), this, SLOT(refreshPreview()));
QDialogButtonBox *buttonslayout = new QDialogButtonBox(Qt::Horizontal, this);
layout->addWidget(buttonslayout);
QPushButton *saveSyntax = new QPushButton(qApp->style()->standardIcon(QStyle::SP_DialogOkButton), tr("Save"), this);
QPushButton *saveAsSyntax = new QPushButton(qApp->style()->standardIcon(QStyle::SP_DialogSaveButton), tr("Save as..."), this);
QPushButton *cancel = new QPushButton(qApp->style()->standardIcon(QStyle::SP_DialogCancelButton), tr("Cancel"), this);
buttonslayout->addButton(saveSyntax, QDialogButtonBox::YesRole);
buttonslayout->addButton(saveAsSyntax, QDialogButtonBox::ActionRole);
buttonslayout->addButton(cancel, QDialogButtonBox::RejectRole);
splitter->setSizes( QList<int>() << splitter->sizeHint().width() << 1 );
if (syntaxList->isGlobal(syntaxName))
saveSyntax->setDisabled(true);
else
connect(saveSyntax, SIGNAL(clicked()), this, SLOT(save()));
connect(saveAsSyntax, SIGNAL(clicked()), this, SLOT(saveAs()));
connect(cancel, SIGNAL(clicked()), this, SLOT(close()));
loadWindowGeometry(this, "Look", "SyntaxEditorGeometry", 0, 50, 790, 480);
}