本文整理汇总了C++中QSplitter::setObjectName方法的典型用法代码示例。如果您正苦于以下问题:C++ QSplitter::setObjectName方法的具体用法?C++ QSplitter::setObjectName怎么用?C++ QSplitter::setObjectName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSplitter
的用法示例。
在下文中一共展示了QSplitter::setObjectName方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QWidget
RawEditorWidget::RawEditorWidget(QWidget * par)
: QWidget(par)
{
setObjectName("raw_event_editor");
QGridLayout * l = new QGridLayout(this);
QSplitter * spl = new QSplitter(Qt::Horizontal,this);
spl->setObjectName("raweditor_splitter");
spl->setChildrenCollapsible(false);
l->addWidget(spl,0,0);
KviTalVBox * boxi = new KviTalVBox(spl);
boxi->setMaximumWidth(200);
m_pTreeWidget = new RawTreeWidget(boxi);
m_pTreeWidget->setColumnCount(1);
m_pTreeWidget->setHeaderLabel(__tr2qs_ctx("RAW Event","editor"));
// m_pTreeWidget->setMultiSelection(false);
m_pTreeWidget->setSelectionMode(QAbstractItemView::SingleSelection);
// m_pTreeWidget->setShowSortIndicator(true);
m_pTreeWidget->setRootIsDecorated(true);
m_pContextPopup = new QMenu(this);
m_pTreeWidget->setContextMenuPolicy(Qt::CustomContextMenu);
connect(m_pTreeWidget,SIGNAL(currentItemChanged(QTreeWidgetItem *,QTreeWidgetItem *)),this,SLOT(currentItemChanged(QTreeWidgetItem *,QTreeWidgetItem *)));
connect(m_pTreeWidget,SIGNAL(customContextMenuRequested(const QPoint &)),this,SLOT(customContextMenuRequested(const QPoint &)));
QPushButton * pb = new QPushButton(__tr2qs_ctx("&Export All to...","editor"),boxi);
connect(pb,SIGNAL(clicked()),this,SLOT(exportAllEvents()));
KviTalVBox * box = new KviTalVBox(spl);
m_pNameEditor = new QLineEdit(box);
m_pNameEditor->setToolTip(__tr2qs_ctx("Edit the RAW event handler name.","editor"));
m_pEditor = KviScriptEditor::createInstance(box);
m_bOneTimeSetupDone = false;
m_pLastEditedItem = 0;
}
示例2: QWidget
PopupEditorWidget::PopupEditorWidget(QWidget * par)
: QWidget(par)
{
m_bSaving = false;
QGridLayout * l = new QGridLayout(this);
QSplitter * spl = new QSplitter(Qt::Horizontal, this);
spl->setObjectName("popupeditor_horizontal_splitter");
spl->setChildrenCollapsible(false);
l->addWidget(spl, 0, 0);
KviTalVBox * box = new KviTalVBox(spl);
m_pTreeWidget = new QTreeWidget(box);
m_pTreeWidget->setHeaderLabel(__tr2qs_ctx("Popup", "editor"));
m_pTreeWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
m_pTreeWidget->header()->setSortIndicatorShown(true);
QPushButton * pb = new QPushButton(__tr2qs_ctx("&Export All to...", "editor"), box);
connect(pb, SIGNAL(clicked()), this, SLOT(exportAll()));
QPushButton * gn = new QPushButton(__tr2qs_ctx("&Export Selected to...", "editor"), box);
connect(gn, SIGNAL(clicked()), this, SLOT(exportSelected()));
m_pEditor = new SinglePopupEditor(spl);
m_bOneTimeSetupDone = false;
m_pLastEditedItem = nullptr;
m_pContextPopup = new QMenu(this);
m_pEmptyContextPopup = new QMenu(this);
spl->setStretchFactor(0, 20);
spl->setStretchFactor(1, 80);
currentItemChanged(nullptr, nullptr);
}
示例3: createWidget
QWidget* WidgetStyle::createWidget(const QString& name)
{
if(name == "CheckBox")
{
QCheckBox* box = new QCheckBox("CheckBox");
box->setObjectName("CheckBox");
return setLayoutWidget({ box }, { 100, 30 });
}
else if(name == "ComboBox")
{
QComboBox* box = new QComboBox;
box->addItem("Item1");
box->addItem("Item3");
box->addItem("Item3");
box->setObjectName("ComboBox");
return setLayoutWidget({ box }, { 70, 30 });
}
else if(name == "DateEdit")
{
QDateEdit* date = new QDateEdit;
date->setObjectName("DateEdit");
return setLayoutWidget({ date }, { 110, 40 });
}
else if(name == "DateTimeEdit")
{
QDateTimeEdit* date = new QDateTimeEdit;
date->setObjectName("DateTimeEdit");
return setLayoutWidget({ date }, { 160, 30 });
}
else if(name == "Dialog")
{
QDialog* dialog = new QDialog;
dialog->setObjectName("Dialog");
return setLayoutWidget({ dialog }, { 160, 110 });
}
else if(name == "DockWidget") //?
{
QDockWidget* widget = new QDockWidget;
widget->setObjectName("DockWidget");
widget->resize(61, 22);
return widget;
}
else if(name == "DoubleSpinBox")
{
QDoubleSpinBox* box = new QDoubleSpinBox;
box->setObjectName("DoubleSpinBox");
return setLayoutWidget({ box }, { 90, 40 });
}
else if(name == "Frame") //??
{
QFrame* frame = new QFrame;
frame->setObjectName("Frame");
frame->resize(150, 100);
return frame;
}
else if(name == "GroupBox")
{
QGroupBox* box = new QGroupBox("GroupBox");
box->setObjectName("GroupBox");
return setLayoutWidget({ box }, { 160, 110 });
}
else if(name == "Label")
{
QLabel* label = new QLabel("Label");
label->setObjectName("Label");
return setLayoutWidget({ label }, { 40, 20});
}
else if(name == "LineEdit")
{
QLineEdit* line = new QLineEdit;
line->setObjectName("LineEdit");
return setLayoutWidget({ line }, { 30, 30 });
}
else if(name == "ListView") //??
{
QListView* view = new QListView;
view->setObjectName("ListView");
view->resize(71, 71);
return view;
}
else if(name == "ListWidget")
{
QListWidget* list = new QListWidget;
list->setObjectName("ListWidget");
for(int i = 0; i < 20; i++)
list->addItem(QString("Item %1").arg(i));
return setLayoutWidget({ list }, { 80, 80 });
}
else if(name == "MainWindow")
{
QMainWindow* window = new QMainWindow;
window->setObjectName("MainWindow");
return setLayoutWidget({ window }, { 160, 110 });
}
else if(name == "Menu")
{
QMenu* parentMenu = new QMenu;
parentMenu->setObjectName("Menu");
parentMenu->addMenu("Menu1");
QMenu* menu1 = parentMenu->addMenu("Menu2");
//.........这里部分代码省略.........
示例4: CreateDialogLayout
void FileBrowser::CreateDialogLayout()
{
QGridLayout *gridLayout;
QGridLayout *gridLayout1;
QGridLayout *gridLayout2;
QSplitter *splitter;
this->setObjectName(QString::fromUtf8("Dialog"));
this->setWindowModality(Qt::ApplicationModal);
QSizePolicy sizePolicy(static_cast<QSizePolicy::Policy>(0), static_cast<QSizePolicy::Policy>(0));
sizePolicy.setHorizontalStretch(0);
sizePolicy.setVerticalStretch(0);
//sizePolicy.setHeightForWidth(this->sizePolicy().hasHeightForWidth());
this->setSizePolicy(sizePolicy);
gridLayout = new QGridLayout(this);
gridLayout->setSizeConstraint(QLayout::SetNoConstraint);
gridLayout->setSpacing(6);
gridLayout->setMargin(9);
gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
gridLayout1 = new QGridLayout();
gridLayout1->setSizeConstraint(QLayout::SetNoConstraint);
gridLayout1->setSpacing(6);
gridLayout1->setMargin(0);
gridLayout1->setObjectName(QString::fromUtf8("gridLayout1"));
gridLayout2 = new QGridLayout();
gridLayout2->setSizeConstraint(QLayout::SetNoConstraint);
gridLayout2->setSpacing(6);
gridLayout2->setMargin(0);
gridLayout2->setObjectName(QString::fromUtf8("gridLayout2"));
splitter = new QSplitter(this);
splitter->setObjectName(QString::fromUtf8("splitter"));
splitter->setOrientation(Qt::Horizontal);
lstDir = new QListWidget(splitter);
lstDir->setObjectName(QString::fromUtf8("lstDir"));
splitter->addWidget(lstDir);
lstFile = new QListWidget(splitter);
lstFile->setObjectName(QString::fromUtf8("lstFile"));
splitter->addWidget(lstFile);
gridLayout2->addWidget(splitter, 0, 0, 1, 2);
btnCancel = new QPushButton(this);
btnCancel->setObjectName(QString::fromUtf8("btnCancel"));
//btnCancel->setIcon(QIcon(QString::fromUtf8("../../../../common/src/sys/QtMapeditor/XPM/16x16/stop.xpm")));
btnCancel->setIcon(QPixmap(stop));
gridLayout2->addWidget(btnCancel, 2, 1, 1, 1);
chkLoadAllClients = new QCheckBox(this);
chkLoadAllClients->setObjectName(QString::fromUtf8("chkLoadAllClients"));
txtFilename = new QLineEdit(this);
txtFilename->setObjectName(QString::fromUtf8("txtFilename"));
gridLayout2->addWidget(txtFilename, 1, 0, 1, 1);
cmbFilter = new QComboBox(this);
cmbFilter->setObjectName(QString::fromUtf8("cmbFilter"));
gridLayout2->addWidget(chkLoadAllClients, 3, 0, 1, 2);
gridLayout2->addWidget(cmbFilter, 2, 0, 1, 1);
btnAccept = new QPushButton(this);
btnAccept->setObjectName(QString::fromUtf8("btnAccept"));
//btnAccept->setIcon(QIcon(QString::fromUtf8("../../../../common/src/sys/QtMapeditor/XPM/16x16/apply.xpm")));
btnAccept->setIcon(QPixmap(apply));
gridLayout2->addWidget(btnAccept, 1, 1, 1, 1);
gridLayout1->addLayout(gridLayout2, 1, 1, 1, 1);
vboxLayout = new QVBoxLayout();
vboxLayout->setSizeConstraint(QLayout::SetNoConstraint);
vboxLayout->setSpacing(6);
vboxLayout->setMargin(0);
vboxLayout->setObjectName(QString::fromUtf8("vboxLayout"));
btnHome = new QPushButton(this);
btnHome->setObjectName(QString::fromUtf8("btnHome"));
//btnHome->setIcon(QIcon(QString::fromUtf8("../../../../common/src/sys/QtMapeditor/XPM/32x32/home32.xpm")));
btnHome->setIcon(QPixmap(home32));
btnHome->setIconSize(QSize(32, 32));
vboxLayout->addWidget(btnHome);
btnMachine = new QPushButton(this);
btnMachine->setObjectName(QString::fromUtf8("btnMachine"));
//btnMachine->setIcon(QIcon(QString::fromUtf8("../../../../common/src/sys/QtMapeditor/XPM/32x32/computer32.xpm")));
btnMachine->setIcon(QPixmap(computer32));
btnMachine->setIconSize(QSize(32, 32));
vboxLayout->addWidget(btnMachine);
btnAccessGrid = new QPushButton(this);
btnAccessGrid->setObjectName(QString::fromUtf8("btnAccessGrid"));
//btnAccessGrid->setIcon(QIcon(QString::fromUtf8("../../../../common/src/sys/QtMapeditor/XPM/32x32/ag32.xpm")));
btnAccessGrid->setIcon(QPixmap(ag32));
btnAccessGrid->setIconSize(QSize(32, 32));
//.........这里部分代码省略.........
示例5: QObject
CollectionViewPrivate::CollectionViewPrivate(CollectionView *parent)
: QObject(parent),
ui(new Ui::CollectionView),
q(parent)
{
ui->setupUi(q);
ui->viewLayout->removeWidget(ui->collectionList);
ui->viewLayout->removeWidget(ui->contentWidget);
QSplitter *splitter = new QSplitter(q);
splitter->setObjectName("__RecordItNow__Splitter1");
splitter->addWidget(ui->collectionList);
splitter->addWidget(ui->contentWidget);
ui->viewLayout->addWidget(splitter);
splitterList.append(splitter);
ui->contentWidgetLayout->removeWidget(ui->searchWidget);
ui->contentWidgetLayout->removeWidget(ui->collectionItemWidget);
splitter = new QSplitter(q);
splitter->setObjectName("__RecordItNow_Splitter2");
splitter->setOrientation(Qt::Vertical);
splitter->addWidget(ui->searchWidget);
splitter->addWidget(ui->collectionItemWidget);
ui->contentWidgetLayout->addWidget(splitter);
splitterList.append(splitter);
ui->collectionList->setButtons(CollectionListWidget::AddButton|CollectionListWidget::DeleteButton|
CollectionListWidget::EditButton);
layout = new QStackedLayout;
layout->setSpacing(0);
layout->setContentsMargins(4, 0, 4, 4);
ui->collectionItemWidget->setLayout(layout);
connect(ui->collectionList, SIGNAL(itemSelectionChanged()), this,
SLOT(collectionSelectionChanged()));
connect(layout, SIGNAL(currentChanged(int)), this, SLOT(currentCollectionListChanged(int)));
searchList = new CollectionListWidget(q, true);
searchList->setButtons(CollectionListWidget::PlayButton|CollectionListWidget::EditButton|
CollectionListWidget::DeleteButton);
connect(searchList, SIGNAL(deleteRequested(RecordItNow::CollectionItem*)), q,
SLOT(deleteItem(RecordItNow::CollectionItem*)));
connect(searchList, SIGNAL(editRequested(RecordItNow::CollectionItem*)), q,
SLOT(editItem(RecordItNow::CollectionItem*)));
connect(searchList, SIGNAL(playRequested(RecordItNow::CollectionItem*)), q,
SIGNAL(playRequested(RecordItNow::CollectionItem*)));
connect(searchList, SIGNAL(uploadRequested(RecordItNow::CollectionItem*)), q,
SIGNAL(uploadRquested(RecordItNow::CollectionItem*)));
layout->addWidget(searchList);
CollectionListWidgetItem *item = new CollectionListWidgetItem(0, searchList);
item->setText(i18n("Search results"));
item->setIcon(KIcon("system-search"));
ui->collectionList->addItem(item);
connect(ui->collectionList, SIGNAL(deleteRequested(RecordItNow::CollectionItem*)), q,
SLOT(deleteItem(RecordItNow::CollectionItem*)));
connect(ui->collectionList, SIGNAL(editRequested(RecordItNow::CollectionItem*)), q,
SLOT(editItem(RecordItNow::CollectionItem*)));
connect(ui->collectionList, SIGNAL(addRequested(RecordItNow::Collection*)), q,
SLOT(createItem(RecordItNow::Collection*)));
ui->searchWidget->setView(q);
ui->searchWidget->setListWidget(searchList);
connect(ui->searchWidget, SIGNAL(activated()), this, SLOT(activateSearchList()));
}
示例6: QMainWindow
ApplicationWindow::ApplicationWindow()
: QMainWindow()
{
setWindowTitle("application main window");
// init some values
QFont boldfont;
QLabel *label;
QFrame *w;
QVBoxLayout *box;
appwin = this;
currClient = NULL;
dialog = NULL;
plugins = NULL;
// set a proper font & layout
setFont(QFont("Helvetica", 8));
// initialize two timer
// timer.....waits for disconneting vrb clients
timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(timerDone()));
// create the menus and toolbar buttons
createMenubar();
createToolbar();
//make a central widget to contain the other widgets
QSplitter *central = new QSplitter(Qt::Vertical, this);
central->setObjectName("main");
central->setOpaqueResize(true);
// create a horizontal splitter window
QSplitter *split = new QSplitter(Qt::Horizontal, central);
split->setObjectName("top");
split->setOpaqueResize(true);
// create the table list for the left side
// contains one entry for each vrb client
w = new QFrame(split);
w->setFrameStyle(QFrame::WinPanel | QFrame::Sunken);
box = new QVBoxLayout(w);
box->setMargin(5);
table = new QTreeWidget(w);
QStringList labels;
labels << "Master"
<< "ID"
<< "Group"
<< "Host";
labels << "User"
<< "Email"
<< "URL"
<< "IP";
table->setHeaderLabels(labels);
table->setMinimumSize(table->sizeHint());
connect(table, SIGNAL(itemClicked(QTreeWidgetem *)),
this, SLOT(showBPS(QTreeWidgetItem *)));
connect(table, SIGNAL(rightButtonClicked(QTreeWidgetItem *, const QPoint &, int)),
this, SLOT(popupCB(QTreeWidgetItem *, const QPoint &, int)));
box->addWidget(table);
// create the tabwidget for the right side
createTabWidget(split);
// create a message area for the bottom
msgFrame = new QFrame(central);
msgFrame->setFrameStyle(QFrame::WinPanel | QFrame::Sunken);
box = new QVBoxLayout(msgFrame);
box->setMargin(5);
label = new QLabel(msgFrame);
label->setText("Message Area");
label->setAlignment(Qt::AlignCenter);
//label->setFont( boldfont );
msg = new QTextEdit(msgFrame);
box->addWidget(label);
box->addWidget(msg);
msgFrame->hide();
// create a file browser
browser = new VRBFileDialog(this);
// create a popupmenu -- available for each vrb client in the table list
popup = new VRBPopupMenu(table);
popup->addAction("&Delete", this, SLOT(deleteItem()));
popup->addAction("&Configure", this, SLOT(configItem()));
//.........这里部分代码省略.........
示例7: QWidget
Vizkit3DWidget::Vizkit3DWidget( QWidget* parent,const QString &world_name,bool auto_update)
: QWidget(parent)
, env_plugin(NULL), pickHandler(new PickHandler())
{
//create layout
//objects will be owned by the parent widget (this)
QVBoxLayout* layout = new QVBoxLayout;
layout->setObjectName("main_layout");
layout->setContentsMargins(2,2,2,2);
QSplitter* splitter = new QSplitter(Qt::Horizontal);
splitter->setObjectName("splitter");
layout->addWidget(splitter);
this->setLayout(layout);
// set threading model
setThreadingModel(osgViewer::CompositeViewer::SingleThreaded);
if (getenv("VIZKIT_GL_DEBUG") && (std::string(getenv("VIZKIT_GL_DEBUG")) == "1"))
{
osg::setNotifyLevel(osg::DEBUG_INFO);
setRealizeOperation(new EnableGLDebugOperation());
}
// disable the default setting of viewer.done() by pressing Escape.
setKeyEventSetsDone(0);
// create root scene node
root = createSceneGraph(world_name);
//create geode that will be used as marker for the current selection
selectorGeode = new osg::Geode();
osg::ShapeDrawable* sphere = new osg::ShapeDrawable(new osg::Sphere(osg::Vec3(), 0.2f));
sphere->setColor(osg::Vec4(1.0f, 0.0f, 0.0f, 0.3f));
sphere->getOrCreateStateSet()->setMode(GL_BLEND,osg::StateAttribute::ON);
selectorGeode->addDrawable(sphere);
osg::StateSet* set = selectorGeode->getOrCreateStateSet();
set->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
set->setAttributeAndModes(new osg::BlendFunc(GL_SRC_ALPHA ,GL_ONE_MINUS_SRC_ALPHA), osg::StateAttribute::ON);
// create osg widget
QWidget* widget = addViewWidget(createGraphicsWindow(0,0,800,600), root);
widget->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
widget->setObjectName(QString("View Widget"));
splitter->addWidget(widget);
// create propertyBrowserWidget
QPropertyBrowserWidget *propertyBrowserWidget = new QPropertyBrowserWidget( parent );
propertyBrowserWidget->setObjectName("PropertyBrowser");
propertyBrowserWidget->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
propertyBrowserWidget->resize(200,600);
splitter->addWidget(propertyBrowserWidget);
// add config object to the property browser
Vizkit3DConfig *config = new Vizkit3DConfig(this);
addProperties(config,NULL);
//connect signals and slots
connect(this, SIGNAL(addPlugins(QObject*,QObject*)), this, SLOT(addPluginIntern(QObject*,QObject*)));
connect(this, SIGNAL(removePlugins(QObject*)), this, SLOT(removePluginIntern(QObject*)));
connect(&_timer, SIGNAL(timeout()), this, SLOT(update()) );
connect(pickHandler.get(), SIGNAL(pickedNodePath(const osg::NodePath&)), this, SLOT(pickNodePath(const osg::NodePath&)));
current_frame = QString(root->getName().c_str());
//start timer responsible for updating osg viewer
if (auto_update)
_timer.start(10);
}
示例8: sizePolicy
//****************************************************************************
MainWindow::MainWindow (QWidget* parent, Qt::WFlags fl)
{
// Setup the QRAP error handling system
QRAP_SET_ALERT_CALLBACK((AlertCallback)(Qrap::MainWindowAlert));
CreateActions();
CreateMenus();
CreateToolBars();
CreateStatusBar();
ReadSettings();
// Create the clipboard
clipboard = QApplication::clipboard();
// Set the window title
setWindowTitle("Q-Rap Database Interface");
setWindowIcon(QIcon(":images/logo_icon.png"));
// Check if there are any system preferences
if(gDb.GetSetting("location")=="")
{
// gDb.SetSetting("location","DD.dddd");
gDb.SetSetting("sensitivity","dBm");
gDb.SetSetting("power","dBm");
gDb.SetSetting("eirp","dBm");
gDb.SetSetting("impedence","50");
gDb.SetSetting("predictioneirp","explicit");
gDb.SetSetting("location","DD:MM:SS");
gDb.SetSetting("mode","normal");
gDb.SetSetting("DisplayUnits","dBm");
gDb.SetSetting("TechType","0:NULL");
gDb.SetSetting("RqSN","8.00");
gDb.SetSetting("FadeMargin","3.00");
gDb.SetSetting("RxMin","-110.00");
gDb.SetSetting("RqCiCo","9.00");
gDb.SetSetting("RqCiad","-9.00");
gDb.SetSetting("RqEbNo","8.00");
gDb.SetSetting("kFactorServer","1.00");
gDb.SetSetting("kFactorInt","2.5");
gDb.SetSetting("UseClutter","false");
gDb.SetSetting("BTLDir","/home/");
gDb.SetSetting("OutputDir","/home");
gDb.SetSetting("SiteSelectSense","150.00");
gDb.SetSetting("PlotResolution","90.00");
gDb.SetSetting("DownLink","true");
} // if GetSetting(location)
// QWidget* gridLayout_1 = new QWidget(this);
// gridLayout_1->setObjectName(QString::fromUtf8("gridLayout_1"));
//gridLayout_1->setGeometry(QRect(0,70,790,180));
// setCentralWidget(gridLayout_1);
// QGridLayout* gridLayout1 = new QGridLayout(gridLayout_1);
// gridLayout1->setSpacing(6);
// gridLayout1->setMargin(0);
// gridLayout1->setObjectName(QString::fromUtf8("gridLayout1"));
QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
sizePolicy.setHorizontalStretch(200);
sizePolicy.setVerticalStretch(200);
QSplitter* splitter;
splitter = new QSplitter(this);
splitter->setObjectName(QString::fromUtf8("splitter"));
splitter->setOrientation(Qt::Horizontal);
splitter->setOpaqueResize(true);
splitter->setSizePolicy(sizePolicy);
sizePolicy.setHeightForWidth(splitter->sizePolicy().hasHeightForWidth());
setCentralWidget(splitter);
rapTab = new RapTab(splitter);
rapTab->setGeometry(QRect(10,10,1550,450));
rapTab->setMinimumSize(QSize(100, 100));
rapTab->setSizePolicy(sizePolicy);
splitter->addWidget(rapTab);
Filter = new cFilter(splitter);
Filter->setGeometry(QRect(10,10,350,450));
Filter->setMinimumSize(QSize(100, 100));
Filter->setSizePolicy(sizePolicy);
splitter->addWidget(Filter);
setMaximumHeight(700);
showMaximized ();
// QSpacerItem *spacerItem1 = new QSpacerItem(1, 90, QSizePolicy::Minimum, QSizePolicy::Minimum);
// gridLayout1->addItem(spacerItem1, 0, 1, 1, 1);
// QSpacerItem *spacerItem = new QSpacerItem(1, 400, QSizePolicy::Minimum, QSizePolicy::Maximum);
// gridLayout1->addItem(spacerItem, 1, 1, 1, 1);
// Create the main widget
// CreateDockingTab(Body);
}
示例9: settings
/* VaultShopMain */
VaultShopMain::VaultShopMain()
{
// Basic Form Settings
setWindowTitle("VaultShop " PLASMASHOP_VERSION);
//setWindowIcon(QIcon(":/res/VaultShop.png"));
// Set up actions
fActions[kFileOpenVault] = new QAction(qStdIcon("document-open"), tr("&Load Vault..."), this);
fActions[kFileSaveVault] = new QAction(qStdIcon("document-save"), tr("&Save Vault"), this);
fActions[kFileExit] = new QAction(tr("E&xit"), this);
fActions[kVaultOpenNode] = new QAction(tr("Subscribe to &Node..."), this);
fActions[kNodeUnLink] = new QAction(tr("Remove"), this);
fActions[kNodeLink] = new QAction(tr("Add Node..."), this);
fActions[kNodeCreate] = new QAction(tr("Create Node"), this);
fActions[kNodeUnsubscribe] = new QAction(tr("Un-subscribe"), this);
//fActions[kNodeRenameVault] = new QAction(tr("Rename Vault..."), this);
fActions[kFileOpenVault]->setShortcut(Qt::CTRL + Qt::Key_O);
fActions[kFileSaveVault]->setShortcut(Qt::CTRL + Qt::Key_S);
fActions[kFileExit]->setShortcut(Qt::ALT + Qt::Key_F4);
fActions[kVaultOpenNode]->setShortcut(Qt::Key_F2);
// Main Menus
QMenu* fileMenu = menuBar()->addMenu(tr("&File"));
fileMenu->addAction(fActions[kFileOpenVault]);
fileMenu->addAction(fActions[kFileSaveVault]);
fileMenu->addSeparator();
fileMenu->addAction(fActions[kFileExit]);
QMenu* vaultMenu = menuBar()->addMenu(tr("&Vault"));
vaultMenu->addAction(fActions[kVaultOpenNode]);
// Toolbars
QToolBar* fileTbar = addToolBar(tr("File Toolbar"));
fileTbar->setObjectName("FileToolBar");
fileTbar->addAction(fActions[kFileOpenVault]);
fileTbar->addAction(fActions[kFileSaveVault]);
statusBar();
// Main Splitter
QSplitter* splitter = new QSplitter(Qt::Horizontal, this);
splitter->setObjectName("Splitter");
// Node Browser
fVaultTree = new QTreeWidget(splitter);
fVaultTree->setUniformRowHeights(true);
fVaultTree->setHeaderHidden(true);
fVaultTree->setContextMenuPolicy(Qt::CustomContextMenu);
// Property Editor
fNodeTab = new QTabWidget(splitter);
fGenericEditor = new QVaultNode(fNodeTab);
fNodeTab->addTab(fGenericEditor, tr("Node Properties"));
fCustomEditor = NULL;
fSavEditor = NULL;
fEditorTabPreference = 0;
// Layout
splitter->addWidget(fVaultTree);
splitter->addWidget(fNodeTab);
setCentralWidget(splitter);
splitter->setSizes(QList<int>() << 160 << 320);
// Global UI Signals
connect(fActions[kFileExit], SIGNAL(triggered()), this, SLOT(close()));
connect(fActions[kFileOpenVault], SIGNAL(triggered()), this, SLOT(openGame()));
connect(fActions[kFileSaveVault], SIGNAL(triggered()), this, SLOT(performSave()));
connect(fActions[kVaultOpenNode], SIGNAL(triggered()), this, SLOT(openNode()));
connect(fActions[kNodeUnLink], SIGNAL(triggered()), this, SLOT(unlinkNode()));
connect(fActions[kNodeLink], SIGNAL(triggered()), this, SLOT(linkNode()));
connect(fActions[kNodeCreate], SIGNAL(triggered()), this, SLOT(createNode()));
connect(fActions[kNodeUnsubscribe], SIGNAL(triggered()), this, SLOT(closeNode()));
//connect(fActions[kNodeRenameVault], SIGNAL(triggered()), this, SLOT(renameVault()));
connect(fVaultTree, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
this, SLOT(treeItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)));
connect(fVaultTree, SIGNAL(customContextMenuRequested(const QPoint&)),
this, SLOT(treeContextMenu(const QPoint&)));
connect(fNodeTab, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int)));
connect(fGenericEditor, SIGNAL(typeModified()), this, SLOT(typeModified()));
connect(this, SIGNAL(nodeChanged(unsigned int)), this, SLOT(refreshNode(unsigned int)));
// Load UI Settings
QSettings settings("PlasmaShop", "VaultShop");
resize(settings.value("WinSize", QSize(480, 600)).toSize());
if (settings.contains("WinPos"))
move(settings.value("WinPos").toPoint());
if (settings.value("WinMaximized", false).toBool())
showMaximized();
if (settings.contains("WinState"))
restoreState(settings.value("WinState").toByteArray());
fLastDir = settings.value("LastDir").toString();
if (!fLastDir.isEmpty())
loadGame(fLastDir);
}