本文整理汇总了C++中QSplitter类的典型用法代码示例。如果您正苦于以下问题:C++ QSplitter类的具体用法?C++ QSplitter怎么用?C++ QSplitter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QSplitter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QSplitter
void EdModule_ShaderEditor::CreateWidgets()
{
this->addDockWidget( Qt::LeftDockWidgetArea, &m_shadersView );
QSplitter *splitter = new QSplitter(this);
splitter->addWidget(&m_codeEditor);
splitter->addWidget(&m_disassembledHLSL);
this->setCentralWidget( splitter );
//@todo: hide disasm view
//const QSize oldSize = m_disassembledHLSL.size();
//m_disassembledHLSL.resize( 0, oldSize.height() );
//m_disassembledHLSL.hide();
}
示例2:
SampleModelView::SampleModelView()
{
model = new SampleModel;
list = new QListView;
list->setModel(model);
tree = new QTreeView;
tree->setModel(model);
QSplitter *splitter = new QSplitter;
splitter->addWidget(list);
splitter->addWidget(tree);
setCentralWidget(splitter);
}
示例3: KDialog
ExportDialog::ExportDialog( const QString& remoteTypeName,
AbstractModelExporterConfigEditor* configEditor,
QWidget* parent )
: KDialog( parent ),
mConfigEditor( configEditor )
{
setCaption( i18nc("@title:window","Export") );
setButtons( Ok | Cancel );
setButtonGuiItem( Ok, KGuiItem(i18nc("@action:button","&Export to File..."), QLatin1String("document-export"),
i18nc("@info:tooltip","Export the selected data to a file."),
i18nc("@info:whatsthis","If you press the <interface>Export to file</interface> "
"button, the selected data will be copied to a file "
"with the settings you entered above.")) );
setDefaultButton( Ok );
QSplitter* splitter = new QSplitter( this );
setMainWidget( splitter );
// config editor
QWidget* editorPage = new QWidget( splitter );
QVBoxLayout* editorPageLayout = new QVBoxLayout( editorPage );
QLabel* editorLabel = new QLabel( remoteTypeName );
QFont font = editorLabel->font();
font.setBold( true );
editorLabel->setFont( font );
editorPageLayout->addWidget( editorLabel );
editorPageLayout->addWidget( mConfigEditor );
editorPageLayout->addStretch();
splitter->addWidget( editorPage );
splitter->setCollapsible( 0, false );
mPreviewView = configEditor->createPreviewView();
if( mPreviewView )
{
QGroupBox* previewBox = new QGroupBox( i18nc("@title:group","Preview"), this );
splitter->addWidget( previewBox );
QHBoxLayout* previewBoxLayout = new QHBoxLayout( previewBox );
previewBoxLayout->addWidget( mPreviewView->widget() );
}
enableButtonOk( configEditor->isValid() );
connect( configEditor, SIGNAL(validityChanged(bool)), SLOT(enableButtonOk(bool)) );
}
示例4: QDialog
AnimCurveWindow::AnimCurveWindow(QWidget* parent) : QDialog(parent)
{
resize(643, 506);
setWindowTitle("AnimCurve");
QVBoxLayout* pMainLayout = new QVBoxLayout(this);
pMainLayout->setMargin(0);
m_centralWidget = new QWidget();
m_centralWidget->setObjectName(QString::fromUtf8("centralWidget"));
QVBoxLayout* pLayout = new QVBoxLayout(m_centralWidget);
pLayout->setMargin(0);
m_pCurvesList = new QListView();
QSplitter* pSplitter = new QSplitter(Qt::Horizontal);
// GraphView* pGraphView = new GraphView(centralWidget());
m_pGraphView = new GraphGLView();
pSplitter->addWidget(m_pCurvesList);
pSplitter->addWidget(m_pGraphView);
pMainLayout->addWidget(pSplitter);
m_statusBar = new QStatusBar();
m_statusBar->setMaximumHeight(16);
m_statusBar->setMinimumHeight(16);
m_statusBar->setFixedHeight(16);
m_statusBar->setObjectName(QString::fromUtf8("statusBar"));
pMainLayout->addWidget(m_statusBar);
// setStatusBar(statusBar);
AnimationCurve* pAnimCurve = NULL;
// pAnimCurve = new AnimationCurveLinear();
pAnimCurve = new AnimationCurveCubic();
pAnimCurve->addKeyFrame(5.0f, 10.0f);
pAnimCurve->addKeyFrame(100.0f, 50.0f);
pAnimCurve->addKeyFrame(200.0f, 40.0f);
// this should include the bounds of the curves...
m_pGraphView->reconfigureViewWindow(0.0f, 0.0f, 300.0f, 200.0f);
m_pGraphView->drawCurve(pAnimCurve);
}
示例5: QSplitter
void gui::MainWindow::InitMainControls()
{
QSplitter* splitter = new QSplitter(Qt::Horizontal, this);
assert(m_fsTreeWidget == nullptr);
m_fsTreeWidget = new FsTreeWidget(this, this);
splitter->addWidget(m_fsTreeWidget);
ElementViewWidget* elementView = new ElementViewWidget(this);
splitter->addWidget(elementView);
QHBoxLayout* mainLayout = new QHBoxLayout(this);
mainLayout->setMargin(5);
mainLayout->setSpacing(0);
mainLayout->addWidget(splitter);
m_ui.centralWidget->setLayout(mainLayout);
connect(m_fsTreeWidget, &gui::FsTreeWidget::CurrentElementChanged, elementView, &gui::ElementViewWidget::SetElement);
}
示例6: QDockWidget
SpectrumWindow::SpectrumWindow(QWidget *pParent)
: QDockWidget(pParent),
m_signal(cSignalSize, 0.0f)
{
setObjectName("spectrumWindow");
setWindowTitle(tr("Audio output"));
createWaveformPlot();
createSpectrumPlot();
QSplitter *pSplitter = new QSplitter(Qt::Horizontal);
pSplitter->insertWidget(0, m_pWaveformPlot);
pSplitter->insertWidget(1, m_pSpectrumPlot);
setWidget(pSplitter);
}
示例7: QSplitter
void
MainWindow::updateWindow(){
QSplitter *mainSplitter = new QSplitter( Qt::Vertical );
QSplitter *upSplitter = new QSplitter( Qt::Horizontal );
upSplitter->addWidget( molTreeViewer );
upSplitter->addWidget( molViewer );
upSplitter->setStretchFactor(0, 8);
upSplitter->setStretchFactor(1, 20);
mainSplitter->addWidget(upSplitter);
mainSplitter->addWidget(termEdit);
mainSplitter->setStretchFactor(0, 20);
mainSplitter->setStretchFactor(1, 2);
setCentralWidget( mainSplitter );
}
示例8: QWidget
Nepomuk::Utils::SearchWidget::SearchWidget(QWidget *parent)
: QWidget(parent),
d_ptr(new SearchWidgetPrivate())
{
Q_D(SearchWidget);
d->q = this;
//query editor widget
d->m_queryEdit = new SearchLineEdit(this);
d->m_queryButton = new KPushButton(i18n("Search"), this);
connect(d->m_queryEdit, SIGNAL(queryChanged(Nepomuk::Query::Query)), this, SLOT(_k_queryComponentChanged()));
connect(d->m_queryButton, SIGNAL(clicked()), this, SLOT(_k_queryComponentChanged()));
//item widget
d->m_itemWidget = new QListView(this);
d->m_resourceModel = new Utils::SimpleResourceModel(this);
d->m_itemWidget->setModel(d->m_resourceModel);
connect(d->m_itemWidget->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SIGNAL(selectionChanged()));
connect(d->m_itemWidget->selectionModel(), SIGNAL(currentChanged( const QModelIndex &,const QModelIndex&)),
this, SLOT(_k_forwardCurrentChanged(const QModelIndex &, const QModelIndex &)));
//facets widget
d->m_facetWidget = new Nepomuk::Utils::FacetWidget(this);
d->setupFacetWidget();
connect(d->m_facetWidget, SIGNAL(queryTermChanged(Nepomuk::Query::Term)), this, SLOT(_k_queryComponentChanged()));
//layout and config
QSplitter* facetSplitter = new QSplitter(this);
facetSplitter->addWidget(d->m_itemWidget);
facetSplitter->addWidget(d->m_facetWidget);
QGridLayout* layout = new QGridLayout( this );
layout->setMargin(0);
layout->addWidget( d->m_queryEdit, 0, 0 );
layout->addWidget( d->m_queryButton, 0, 1 );
layout->addWidget( facetSplitter, 1, 0, 1, 2 );
layout->setRowStretch(1,1);
// query client setup
connect( &d->m_queryClient, SIGNAL(newEntries(QList<Nepomuk::Query::Result>)),
d->m_resourceModel, SLOT(addResults(QList<Nepomuk::Query::Result>)) );
connect( &d->m_queryClient, SIGNAL(finishedListing()),
this, SLOT(_k_listingFinished()));
setSelectionMode(QListView::ExtendedSelection);
setConfigFlags( DefaultConfigFlags );
}
示例9: restoreViewContainer
QWidget* ViewAreaImpl::restoreSplitter(const Mapping& state, Archive* archive)
{
QWidget* widget = 0;
QWidget* childWidgets[2] = { 0, 0 };
const Listing& children = *state.findListing("children");
if(children.isValid()){
int numChildren = std::min(children.size(), 2);
for(int i=0; i < numChildren; ++i){
if(children[i].isMapping()){
const Mapping& childState = *children[i].toMapping();
childWidgets[i] = restoreViewContainer(childState, archive);
}
}
if(!childWidgets[0] || !childWidgets[1]){
for(int i=0; i < 2; ++i){
if(childWidgets[i]){
widget = childWidgets[i];
break;
}
}
} else {
QSplitter* splitter = new QSplitter();
string orientation;
if(state.read("orientation", orientation)){
splitter->setOrientation((orientation == "vertical") ? Qt::Vertical : Qt::Horizontal);
}
splitter->addWidget(childWidgets[0]);
splitter->addWidget(childWidgets[1]);
const Listing& sizes = *state.findListing("sizes");
if(sizes.isValid() && sizes.size() == 2){
QList<int> s;
int size;
for(int i=0; i < 2; ++i){
if(sizes[i].read(size)){
s.push_back(size);
}
}
splitter->setSizes(s);
}
widget = splitter;
}
}
return widget;
}
示例10: qDebug
void FrostEdit::split(TabWidgetFrame* tab, Qt::Orientation orient) {
QWidget* parent = tab->parentWidget();
QSplitter* parentsplitter = qobject_cast<QSplitter*>(parent);
FrostEdit* parentedit = qobject_cast<FrostEdit*>(parent);
qDebug()<<parentsplitter;
qDebug()<<parentedit;
int size = (orient == Qt::Horizontal ? tab->width() : tab->height()) / 2;
//Currently the tabwidget frame's parently is the Editor itself
if(parentedit != nullptr && parentsplitter == nullptr) {
QSplitter* splitter(new QSplitter(orient));
qDebug() << centralWidget();
mTabWidgetFrames.append(new TabWidgetFrame(splitter));
tab->setParent(splitter);
splitter->addWidget(tab);
splitter->addWidget(mTabWidgetFrames.last());
splitter->setSizes({size, size});
setCentralWidget(splitter);
//Parent widget seems to be splitter
} else if(parentsplitter != nullptr && parentedit == nullptr) {
QSplitter* splitter(new QSplitter(orient));
parentsplitter->addWidget(splitter);
splitter->addWidget(tab);
mTabWidgetFrames.append(new TabWidgetFrame());
splitter->addWidget(mTabWidgetFrames.last());
splitter->setSizes({size, size});
splitter->show();
}
connectTabWidgetFrameSignals(mTabWidgetFrames.last());
for(Document* doc: mOpenDocuments)
if(doc != nullptr)
mTabWidgetFrames.last()->addComboBoxItem(doc->getFullPath());
}
示例11: QWidget
Widget::Widget(QWidget *parent)
: QWidget(parent)
{
QVBoxLayout *layout = new QVBoxLayout;
QSplitter *vsplit = new QSplitter(Qt::Vertical);
layout->addWidget(vsplit);
QSplitter *hsplit = new QSplitter;
QVBoxLayout *settingsLayout = new QVBoxLayout;
addVersions(settingsLayout);
addProfiles(settingsLayout);
addOptions(settingsLayout);
addRenderableTypes(settingsLayout);
hsplit->addWidget(widgetWithLayout(settingsLayout));
QVBoxLayout *outputLayout = new QVBoxLayout;
m_output = new QTextEdit;
m_output->setReadOnly(true);
outputLayout->addWidget(m_output);
m_extensions = new QTextEdit;
m_extensions->setReadOnly(true);
outputLayout->addWidget(m_extensions);
hsplit->addWidget(widgetWithLayout(outputLayout));
hsplit->setStretchFactor(0, 4);
hsplit->setStretchFactor(1, 6);
vsplit->addWidget(hsplit);
m_renderWindowLayout = new QVBoxLayout;
vsplit->addWidget(widgetWithLayout(m_renderWindowLayout));
vsplit->setStretchFactor(1, 5);
m_renderWindowContainer = new QWidget;
addRenderWindow();
QString description;
QTextStream str(&description);
str << "Qt " << QT_VERSION_STR << ' ' << QGuiApplication::platformName();
const char *openGlVariables[] =
{"QT_ANGLE_PLATFORM", "QT_OPENGL", "QT_OPENGL_BUGLIST", "QT_OPENGL_DLL"};
const size_t variableCount = sizeof(openGlVariables) / sizeof(openGlVariables[0]);
for (size_t v = 0; v < variableCount; ++v) {
if (qEnvironmentVariableIsSet(openGlVariables[v]))
str << ' ' << openGlVariables[v] << '=' << qgetenv(openGlVariables[v]);
}
if (QCoreApplication::testAttribute(Qt::AA_UseOpenGLES))
str << " Qt::AA_UseOpenGLES";
if (QCoreApplication::testAttribute(Qt::AA_UseSoftwareOpenGL))
str << " Qt::AA_UseSoftwareOpenGL";
if (QCoreApplication::testAttribute(Qt::AA_UseDesktopOpenGL))
str << " Qt::AA_UseSoftwareOpenGL";
layout->addWidget(new QLabel(description));
setLayout(layout);
}
示例12: QWidget
TermWidgetHolder::TermWidgetHolder(const QString & wdir, const QString & shell, QWidget * parent)
: QWidget(parent),
m_wdir(wdir)
{
setFocusPolicy(Qt::NoFocus);
QGridLayout * lay = new QGridLayout(this);
lay->setSpacing(0);
lay->setContentsMargins(0, 0, 0, 0);
QSplitter *s = new QSplitter(this);
s->setFocusPolicy(Qt::NoFocus);
TermWidget *w = newTerm(shell);
s->addWidget(w);
lay->addWidget(s);
setLayout(lay);
}
示例13: QWidget
QueryWidget::QueryWidget(IServerSPtr server, QWidget* parent)
: QWidget(parent)
{
shellWidget_ = new BaseShellWidget(server);
outputWidget_ = new OutputWidget(server);
VERIFY(connect(shellWidget_, &BaseShellWidget::rootCreated, outputWidget_, &OutputWidget::rootCreate));
VERIFY(connect(shellWidget_, &BaseShellWidget::rootCompleated, outputWidget_, &OutputWidget::rootCompleate));
VERIFY(connect(shellWidget_, &BaseShellWidget::addedChild, outputWidget_, &OutputWidget::addChild));
VERIFY(connect(shellWidget_, &BaseShellWidget::itemUpdated, outputWidget_, &OutputWidget::itemUpdate));
QSplitter* splitter = new QSplitter;
#ifdef OS_WIN
splitter->setStyleSheet("QSplitter::handle { background-color: gray }");
#endif
splitter->setOrientation(Qt::Vertical);
splitter->setHandleWidth(1);
QVBoxLayout *mainLayout = new QVBoxLayout;
splitter->addWidget(shellWidget_);
splitter->addWidget(outputWidget_);
splitter->setStretchFactor(0, 0);
splitter->setStretchFactor(1, 1);
mainLayout->addWidget(splitter);
setMinimumSize(QSize(min_width, min_height));
setLayout(mainLayout);
}
示例14: Q3GridLayout
VariantPropertyDialog::VariantPropertyDialog( QWidget * parent, const char * name , bool modal, Qt::WFlags f )
:QDialog (parent, name, modal, f)
{
Q3GridLayout * grid_layout = new Q3GridLayout( this, 1, 1, 11, 6, "GridLayout");
QSplitter * splitter = new QSplitter( this, "splitter3" );
splitter->setOrientation( Qt::Horizontal );
table = new VariantItemTable( splitter, "table" );
table->setNumCols (1);
// table->show();
treeview = new VariantListTreeView( splitter, table );
treeview->addColumn( tr( "Column 1" ) );
// treview->show();
splitter->moveToFirst (treeview);
grid_layout->addWidget( splitter, 0, 0 );
Q3HBoxLayout * layout4 = new Q3HBoxLayout( 0, 0, 6, "layout4");
QSpacerItem * spacer2 = new QSpacerItem( 40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
layout4->addItem( spacer2 );
btn_ok = new QPushButton( this, "Ok" );
btn_ok->setText ("Ok");
connect (btn_ok, SIGNAL (clicked()), this, SLOT (accept() ) );
layout4->addWidget( btn_ok );
QSpacerItem * spacer1 = new QSpacerItem( 200, 23, QSizePolicy::Expanding, QSizePolicy::Minimum );
layout4->addItem( spacer1 );
btn_cancel = new QPushButton( this, "Cancel" );
btn_cancel->setText ("Cancel");
connect (btn_cancel, SIGNAL (clicked()), this, SLOT (reject() ) );
layout4->addWidget( btn_cancel );
QSpacerItem * spacer4 = new QSpacerItem( 40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
layout4->addItem( spacer4 );
grid_layout->addLayout( layout4, 1, 0 );
resize( QSize(735, 568).expandedTo(minimumSizeHint()) );
//clearWState( WState_Polished );
}
示例15: QDialog
/**************************************************************************
Help dialog constructor
**************************************************************************/
help_dialog::help_dialog(QWidget *parent) :
QDialog(parent)
{
QSplitter *splitter;
QList<int> sizes;
QTreeWidgetItem *first;
QVBoxLayout *layout;
QDialogButtonBox *box;
setWindowTitle(_("Freeciv Help Browser"));
setWindowFlags(Qt::WindowStaysOnTopHint);
resize(750, 450);
layout = new QVBoxLayout(this);
splitter = new QSplitter(this);
layout->addWidget(splitter);
tree_wdg = new QTreeWidget();
tree_wdg->setHeaderHidden(true);
make_tree();
splitter->addWidget(tree_wdg);
help_wdg = new help_widget(splitter);
connect(
tree_wdg,
SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)),
this, SLOT(item_changed(QTreeWidgetItem *)));
help_wdg->layout()->setContentsMargins(0, 0, 0, 0);
splitter->addWidget(help_wdg);
sizes << 150 << 600;
splitter->setSizes(sizes);
box = new QDialogButtonBox(QDialogButtonBox::Close);
layout->addWidget(box);
box->addButton(_("About Qt"), QDialogButtonBox::HelpRole);
box->button(QDialogButtonBox::Close)->setDefault(true);
connect(box, &QDialogButtonBox::rejected, this, &QWidget::close);
connect(box, &QDialogButtonBox::helpRequested, &QApplication::aboutQt);
first = tree_wdg->topLevelItem(0);
if (first) {
tree_wdg->setCurrentItem(first);
}
}