本文整理汇总了C++中QToolBar::addSeparator方法的典型用法代码示例。如果您正苦于以下问题:C++ QToolBar::addSeparator方法的具体用法?C++ QToolBar::addSeparator怎么用?C++ QToolBar::addSeparator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QToolBar
的用法示例。
在下文中一共展示了QToolBar::addSeparator方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateEditActions
void CQTOpenGLLuaMainWindow::CreateEditActions() {
QIcon cEditUndoIcon;
cEditUndoIcon.addPixmap(QPixmap(m_pcMainWindow->GetIconDir() + "/undo.png"));
m_pcEditUndoAction = new QAction(cEditUndoIcon, tr("&Undo"), this);
m_pcEditUndoAction->setToolTip(tr("Undo last operation"));
m_pcEditUndoAction->setStatusTip(tr("Undo last operation"));
m_pcEditUndoAction->setShortcut(QKeySequence::Undo);
connect(m_pcEditUndoAction, SIGNAL(triggered()),
m_pcCodeEditor, SLOT(undo()));
QIcon cEditRedoIcon;
cEditRedoIcon.addPixmap(QPixmap(m_pcMainWindow->GetIconDir() + "/redo.png"));
m_pcEditRedoAction = new QAction(cEditRedoIcon, tr("&Redo"), this);
m_pcEditRedoAction->setToolTip(tr("Redo last operation"));
m_pcEditRedoAction->setStatusTip(tr("Redo last operation"));
m_pcEditRedoAction->setShortcut(QKeySequence::Redo);
connect(m_pcEditRedoAction, SIGNAL(triggered()),
m_pcCodeEditor, SLOT(redo()));
QIcon cEditCopyIcon;
cEditCopyIcon.addPixmap(QPixmap(m_pcMainWindow->GetIconDir() + "/copy.png"));
m_pcEditCopyAction = new QAction(cEditCopyIcon, tr("&Copy"), this);
m_pcEditCopyAction->setToolTip(tr("Copy selected text into clipboard"));
m_pcEditCopyAction->setStatusTip(tr("Copy selected text into clipboard"));
m_pcEditCopyAction->setShortcut(QKeySequence::Copy);
connect(m_pcEditCopyAction, SIGNAL(triggered()),
m_pcCodeEditor, SLOT(copy()));
QIcon cEditCutIcon;
cEditCutIcon.addPixmap(QPixmap(m_pcMainWindow->GetIconDir() + "/cut.png"));
m_pcEditCutAction = new QAction(cEditCutIcon, tr("&Cut"), this);
m_pcEditCutAction->setToolTip(tr("Move selected text into clipboard"));
m_pcEditCutAction->setStatusTip(tr("Move selected text into clipboard"));
m_pcEditCutAction->setShortcut(QKeySequence::Cut);
connect(m_pcEditCutAction, SIGNAL(triggered()),
m_pcCodeEditor, SLOT(cut()));
QIcon cEditPasteIcon;
cEditPasteIcon.addPixmap(QPixmap(m_pcMainWindow->GetIconDir() + "/paste.png"));
m_pcEditPasteAction = new QAction(cEditPasteIcon, tr("&Paste"), this);
m_pcEditPasteAction->setToolTip(tr("Paste text from clipboard"));
m_pcEditPasteAction->setStatusTip(tr("Paste text from clipboard"));
m_pcEditPasteAction->setShortcut(QKeySequence::Paste);
connect(m_pcEditPasteAction, SIGNAL(triggered()),
m_pcCodeEditor, SLOT(paste()));
// QIcon cEditFindIcon;
// cEditFindIcon.addPixmap(QPixmap(m_pcMainWindow->GetIconDir() + "/find.png"));
// m_pcEditFindAction = new QAction(cEditFindIcon, tr("&Find/Replace"), this);
// m_pcEditFindAction->setToolTip(tr("Find/replace text"));
// m_pcEditFindAction->setStatusTip(tr("Find/replace text"));
// m_pcEditFindAction->setShortcut(QKeySequence::Find);
// connect(m_pcEditFindAction, SIGNAL(triggered()),
// this, SLOT(Find()));
QMenu* pcMenu = menuBar()->addMenu(tr("&Edit"));
pcMenu->addAction(m_pcEditUndoAction);
pcMenu->addAction(m_pcEditRedoAction);
pcMenu->addSeparator();
pcMenu->addAction(m_pcEditCopyAction);
pcMenu->addAction(m_pcEditCutAction);
pcMenu->addAction(m_pcEditPasteAction);
// pcMenu->addSeparator();
// pcMenu->addAction(m_pcEditFindAction);
QToolBar* pcToolBar = addToolBar(tr("Edit"));
pcToolBar->setObjectName("EditToolBar");
pcToolBar->setIconSize(QSize(32,32));
pcToolBar->addAction(m_pcEditUndoAction);
pcToolBar->addAction(m_pcEditRedoAction);
pcToolBar->addSeparator();
pcToolBar->addAction(m_pcEditCopyAction);
pcToolBar->addAction(m_pcEditCutAction);
pcToolBar->addAction(m_pcEditPasteAction);
// pcToolBar->addAction(m_pcEditFindAction);
}
示例2: documentation
//.........这里部分代码省略.........
distLabel[i]->setToolTip (tr ("Distance in meters from selected points"));
distLabel[i]->setAutoFillBackground (TRUE);
distLabelPalette[i] = distLabel[i]->palette ();
statusBar[i]->addWidget (dateLabel[i], 1);
statusBar[i]->addWidget (lineLabel[i]);
statusBar[i]->addWidget (distLabel[i]);
}
// Button, button, who's got the buttons?
bQuit = new QToolButton (this);
bQuit->setIcon (QIcon (":/icons/quit.xpm"));
bQuit->setToolTip (tr ("Quit"));
bQuit->setWhatsThis (quitText);
connect (bQuit, SIGNAL (clicked ()), this, SLOT (slotQuit ()));
tools->addWidget (bQuit);
bMode = new QToolButton (this);
if (wave_line_mode)
{
bMode->setIcon (QIcon (":/icons/mode_line.xpm"));
}
else
{
bMode->setIcon (QIcon (":/icons/mode_dot.xpm"));
}
bMode->setToolTip (tr ("Wave drawing mode toggle"));
bMode->setWhatsThis (modeText);
bMode->setCheckable (TRUE);
bMode->setChecked (wave_line_mode);
connect (bMode, SIGNAL (toggled (bool)), this, SLOT (slotMode (bool)));
tools->addWidget (bMode);
bPrefs = new QToolButton (this);
bPrefs->setIcon (QIcon (":/icons/prefs.xpm"));
bPrefs->setToolTip (tr ("Change application preferences"));
bPrefs->setWhatsThis (prefsText);
connect (bPrefs, SIGNAL (clicked ()), this, SLOT (slotPrefs ()));
tools->addWidget (bPrefs);
tools->addSeparator ();
tools->addSeparator ();
QAction *bHelp = QWhatsThis::createAction (this);
bHelp->setIcon (QIcon (":/icons/contextHelp.xpm"));
tools->addAction (bHelp);
// Setup the file menu.
QAction *fileQuitAction = new QAction (tr ("&Quit"), this);
fileQuitAction->setShortcut (tr ("Ctrl+Q"));
fileQuitAction->setStatusTip (tr ("Exit from application"));
connect (fileQuitAction, SIGNAL (triggered ()), this, SLOT (slotQuit ()));
QMenu *fileMenu = menuBar ()->addMenu (tr ("&File"));
fileMenu->addAction (fileQuitAction);
// Setup the help menu.
QAction *aboutAct = new QAction (tr ("&About"), this);
aboutAct->setShortcut (tr ("Ctrl+A"));
aboutAct->setStatusTip (tr ("Information about waveWaterfall"));
connect (aboutAct, SIGNAL (triggered ()), this, SLOT (about ()));
QAction *acknowledgements = new QAction (tr ("A&cknowledgements"), this);
acknowledgements->setShortcut (tr ("Ctrl+c"));
acknowledgements->setStatusTip (tr ("Information about supporting libraries"));
connect (acknowledgements, SIGNAL (triggered ()), this, SLOT (slotAcknowledgements ()));
QAction *aboutQtAct = new QAction (tr ("About&Qt"), this);
aboutQtAct->setShortcut (tr ("Ctrl+Q"));
aboutQtAct->setStatusTip (tr ("Information about Qt"));
connect (aboutQtAct, SIGNAL (triggered ()), this, SLOT (aboutQt ()));
QMenu *helpMenu = menuBar ()->addMenu (tr ("&Help"));
helpMenu->addAction (aboutAct);
helpMenu->addSeparator ();
helpMenu->addAction (acknowledgements);
helpMenu->addAction (aboutQtAct);
map->setCursor (Qt::ArrowCursor);
map->enableSignals ();
QTimer *track = new QTimer (this);
connect (track, SIGNAL (timeout ()), this, SLOT (trackCursor ()));
track->start (10);
}
示例3: QWidget
Reviews::Reviews( QWidget * parent, Okular::Document * document )
: QWidget( parent ), m_document( document )
{
// create widgets and layout them vertically
QVBoxLayout * vLayout = new QVBoxLayout( this );
vLayout->setMargin( 0 );
vLayout->setSpacing( 6 );
m_view = new TreeView( m_document, this );
m_view->setAlternatingRowColors( true );
m_view->setSelectionMode( QAbstractItemView::ExtendedSelection );
m_view->header()->hide();
QToolBar *toolBar = new QToolBar( this );
toolBar->setObjectName( QLatin1String( "reviewOptsBar" ) );
QSizePolicy sp = toolBar->sizePolicy();
sp.setVerticalPolicy( QSizePolicy::Minimum );
toolBar->setSizePolicy( sp );
m_model = new AnnotationModel( m_document, m_view );
m_filterProxy = new PageFilterProxyModel( m_view );
m_groupProxy = new PageGroupProxyModel( m_view );
m_authorProxy = new AuthorGroupProxyModel( m_view );
m_filterProxy->setSourceModel( m_model );
m_groupProxy->setSourceModel( m_filterProxy );
m_authorProxy->setSourceModel( m_groupProxy );
m_view->setModel( m_authorProxy );
m_searchLine = new KTreeViewSearchLine( this, m_view );
m_searchLine->setCaseSensitivity( Okular::Settings::self()->reviewsSearchCaseSensitive() ? Qt::CaseSensitive : Qt::CaseInsensitive );
m_searchLine->setRegularExpression( Okular::Settings::self()->reviewsSearchRegularExpression() );
connect( m_searchLine, SIGNAL(searchOptionsChanged()), this, SLOT(saveSearchOptions()) );
vLayout->addWidget( m_searchLine );
vLayout->addWidget( m_view );
vLayout->addWidget( toolBar );
toolBar->setIconSize( QSize( 16, 16 ) );
toolBar->setMovable( false );
// - add Page button
QAction * groupByPageAction = toolBar->addAction( KIcon( "text-x-generic" ), i18n( "Group by Page" ) );
groupByPageAction->setCheckable( true );
connect( groupByPageAction, SIGNAL(toggled(bool)), this, SLOT(slotPageEnabled(bool)) );
groupByPageAction->setChecked( Okular::Settings::groupByPage() );
// - add Author button
QAction * groupByAuthorAction = toolBar->addAction( KIcon( "user-identity" ), i18n( "Group by Author" ) );
groupByAuthorAction->setCheckable( true );
connect( groupByAuthorAction, SIGNAL(toggled(bool)), this, SLOT(slotAuthorEnabled(bool)) );
groupByAuthorAction->setChecked( Okular::Settings::groupByAuthor() );
// - add separator
toolBar->addSeparator();
// - add Current Page Only button
QAction * curPageOnlyAction = toolBar->addAction( KIcon( "arrow-down" ), i18n( "Show reviews for current page only" ) );
curPageOnlyAction->setCheckable( true );
connect( curPageOnlyAction, SIGNAL(toggled(bool)), this, SLOT(slotCurrentPageOnly(bool)) );
curPageOnlyAction->setChecked( Okular::Settings::currentPageOnly() );
connect( m_view, SIGNAL(activated(QModelIndex)),
this, SLOT(activated(QModelIndex)) );
m_view->setContextMenuPolicy( Qt::CustomContextMenu );
connect( m_view, SIGNAL(customContextMenuRequested(QPoint)),
this, SLOT(contextMenuRequested(QPoint)) );
}
示例4: createToolBar
//---------------------------------------------------------------
void SkewTWindow::createToolBar ()
{
QToolBar *toolBar = addToolBar (tr("skewt"));
toolBar->setFloatable(false);
toolBar->setMovable(false);
//------------------------------------
acExit = new QAction (this);
acExit->setToolTip (tr("Close the window"));
acExit->setIcon(QIcon(Util::pathImg("exit.png")));
connect(acExit, SIGNAL(triggered()), this, SLOT(actionsCommonSlot()));
toolBar->addAction (acExit);
acPrint = new QAction (this);
acPrint->setToolTip (tr("Print the diagram"));
acPrint->setIcon(QIcon(Util::pathImg("printer.png")));
connect(acPrint, SIGNAL(triggered()), this, SLOT(actionsCommonSlot()));
toolBar->addAction (acPrint);
acSaveImage = new QAction (this);
acSaveImage->setToolTip (tr("Save current image"));
acSaveImage->setIcon(QIcon(Util::pathImg("media-floppy.png")));
connect(acSaveImage, SIGNAL(triggered()), this, SLOT(actionsCommonSlot()));
toolBar->addAction (acSaveImage);
acExportData = new QAction (this);
acExportData->setToolTip (tr("Export data (spreadsheet file)"));
acExportData->setIcon(QIcon(Util::pathImg("spreadsheet.png")));
connect(acExportData, SIGNAL(triggered()), this, SLOT(actionsCommonSlot()));
toolBar->addAction (acExportData);
toolBar->addSeparator();
//------------------------------------
toolBar->addWidget (new QLabel (tr("T max: ")));
cbTempMax = new QComboBox (this);
for (int t=-40; t<=80; t+=5)
cbTempMax->addItem (QString("%1 °C").arg(t), t);
cbTempMax->setMaxVisibleItems (50);
connect(cbTempMax, SIGNAL(activated(int)), this, SLOT(actionsCommonSlot()));
double tmax = Util::getSetting ("skewt_tempCMax", 40).toDouble();
cbTempMax->setCurrentIndex (cbTempMax->findData (tmax));
toolBar->addWidget (cbTempMax);
//------------------------------------
toolBar->addWidget (new QLabel (tr("P min: ")));
cbHpaMin = new QComboBox (this);
for (int p=100; p<=700; p+=100)
cbHpaMin->addItem (QString("%1 hPa").arg(p), p-5);
connect(cbHpaMin, SIGNAL(activated(int)), this, SLOT(actionsCommonSlot()));
double pmin = Util::getSetting ("skewt_hpaMin", 190).toDouble();
cbHpaMin->setCurrentIndex (cbHpaMin->findData (pmin));
toolBar->addWidget (cbHpaMin);
//------------------------------------
double sz;
toolBar->addWidget (new QLabel (tr("Size: ")));
cbSizeW = new QComboBox (this);
for (double s=600; s<=2000; s+=200)
cbSizeW->addItem (QString("%1").arg(s), s);
connect(cbSizeW, SIGNAL(activated(int)), this, SLOT(actionsCommonSlot()));
sz = Util::getSetting ("skewt_sizeW", 800).toDouble();
cbSizeW->setCurrentIndex (cbSizeW->findData (sz));
toolBar->addWidget (cbSizeW);
cbSizeH = new QComboBox (this);
for (double s=600; s<=2000; s+=200)
cbSizeH->addItem (QString("%1").arg(s), s);
connect(cbSizeH, SIGNAL(activated(int)), this, SLOT(actionsCommonSlot()));
sz = Util::getSetting ("skewt_sizeH", 800).toDouble();
cbSizeH->setCurrentIndex (cbSizeH->findData (sz));
toolBar->addWidget (cbSizeH);
toolBar->addSeparator();
//------------------------------------
chkShowConv = new QCheckBox (tr("Base: "),this);
chkShowConv->setChecked (Util::getSetting ("skewt_showConvectiveCurves",true).toBool());
connect(chkShowConv, SIGNAL(stateChanged(int)), this, SLOT(actionsCommonSlot()));
toolBar->addWidget (chkShowConv);
cbConvBase = new QComboBox (this);
if (skewt->hasSurfaceData) {
cbConvBase->addItem ( ("Surface"), "surface");
cbConvBase->addItem ( ("Avg Surface-10 hPa"), "surface-10");
cbConvBase->addItem ( ("Avg Surface-20 hPa"), "surface-20");
cbConvBase->addItem ( ("Avg Surface-50 hPa"), "surface-50");
cbConvBase->addItem ( ("Avg Surface-100 hPa"), "surface-100");
}
cbConvBase->addItem ("1000 hPa", "1000-1000");
cbConvBase->addItem ("975 hPa", "975-975");
cbConvBase->addItem ("950 hPa", "950-950");
cbConvBase->addItem ("925 hPa", "925-925");
cbConvBase->addItem ("900 hPa", "900-900");
cbConvBase->addItem ("850 hPa", "850-850");
cbConvBase->addItem ("800 hPa", "800-800");
cbConvBase->addItem ("750 hPa", "750-750");
cbConvBase->addItem ("700 hPa", "700-700");
cbConvBase->addItem ("650 hPa", "650-650");
cbConvBase->addItem ("Avg 1000-975 hPa", "1000-975");
cbConvBase->addItem ("Avg 1000-950 hPa", "1000-950");
cbConvBase->addItem ("Avg 1000-925 hPa", "1000-925");
cbConvBase->addItem ("Avg 1000-900 hPa", "1000-900");
cbConvBase->addItem ("Avg 1000-850 hPa", "1000-850");
cbConvBase->addItem ("Avg 1000-800 hPa", "1000-800");
//.........这里部分代码省略.........
示例5: s
FenPrincipale::FenPrincipale()
{
showMaximized();
//showNormal();
QMenu *menuFichier = menuBar()->addMenu("&Fichier");
QAction *actionLoadImage = menuFichier->addAction("&Load Image");
actionLoadImage->setIcon(QIcon("Icons/fileopen.png"));
menuFichier->addAction(actionLoadImage);
QAction *actionExit = menuFichier->addAction("&Quitter");
actionExit->setIcon(QIcon("Icons/fileclose.png"));
menuFichier->addAction(actionExit);
//QMenu *menuTools = menuBar()->addMenu("&Tools");
QMenu *menuComm = menuBar()->addMenu("&Communication");
QAction *actionSend = menuComm->addAction("&Send to server");
actionSend->setIcon(QIcon("Icons/ok.png"));
// Création de la barre d'outils
QToolBar *toolBarFichier = addToolBar("Fichier");
toolBarFichier->addAction(actionLoadImage);
toolBarFichier->addAction(actionExit);
toolBarFichier->addSeparator();
toolBarFichier->addAction(actionSend);
QObject::connect(actionLoadImage, SIGNAL(triggered()), this, SLOT(LoadImageW()));
QObject::connect(actionExit, SIGNAL(triggered()), this, SLOT(close()));
QObject::connect(actionSend, SIGNAL(triggered()), this, SLOT(SendServer()));
QObject::connect(actionSend, SIGNAL(triggered()), this, SLOT(ShowResults()));
//
// Création des docks
//
// dock IMAGE
dockImage = new QDockWidget("Image", this);
setCentralWidget(dockImage);
ImageWidget = new QWidget;
dockImage->setWidget(ImageWidget);
// dock SERVEUR
dockServeur = new QDockWidget("Serveur", this);
addDockWidget(Qt::LeftDockWidgetArea, dockServeur);
QWidget *paramDock = new QWidget;
dockServeur->setWidget(paramDock);
QSize s(220,20);
adressServer1 = new QLineEdit(QString("138.195.102.25"));
adressServer1->setMaximumSize(s);
QHBoxLayout *adressLayout = new QHBoxLayout;
adressLayout->addWidget(adressServer1);
QWidget *adressWidget = new QWidget;
adressWidget->setLayout(adressLayout);
portAdressServer = new QLineEdit(QString("6006"));
portAdressServer->setMaximumSize(s);
QHBoxLayout *portLayout = new QHBoxLayout;
portLayout->addWidget(portAdressServer);
QWidget *portAdressWidget = new QWidget;
portAdressWidget->setLayout(portLayout);
QLabel *adressLabel = new QLabel("Adresse IP",paramDock);
QLabel *portLabel = new QLabel("Port",paramDock);
QPushButton *okServer = new QPushButton("Send");
QObject::connect(okServer, SIGNAL(clicked()),this,SLOT(SendServer()));
QObject::connect(okServer, SIGNAL(clicked()),this,SLOT(ShowResults()));
QVBoxLayout *paramLayout = new QVBoxLayout(paramDock);
paramLayout->addWidget(adressLabel);
paramLayout->addWidget(adressWidget);
paramLayout->addWidget(portLabel);
paramLayout->addWidget(portAdressWidget);
paramLayout->addWidget(okServer);
paramLayout->setAlignment(Qt::AlignLeft);
paramDock->setLayout(paramLayout);
//dockServeur->setGeometry(QRect(100,200,200,250));
dockServeur->setMaximumSize(250,200);
// dock RESULTATS
dockResults = new QDockWidget("Resultats",this);
addDockWidget(Qt::RightDockWidgetArea, dockResults);
dockResults->setMaximumWidth(250);
//.........这里部分代码省略.........
示例6: QMainWindow
PianorollEditor::PianorollEditor(QWidget* parent)
: QMainWindow(parent)
{
setWindowTitle(QString("MuseScore"));
waveView = 0;
_score = 0;
staff = 0;
QWidget* mainWidget = new QWidget;
QToolBar* tb = addToolBar(tr("toolbar 1"));
tb->addAction(getAction("undo"));
tb->addAction(getAction("redo"));
tb->addSeparator();
#ifdef HAS_MIDI
tb->addAction(getAction("midi-on"));
#endif
tb->addSeparator();
tb->addAction(getAction("rewind"));
tb->addAction(getAction("play"));
tb->addSeparator();
tb->addAction(getAction("loop"));
tb->addSeparator();
tb->addAction(getAction("repeat"));
tb->addAction(getAction("follow"));
tb->addSeparator();
tb->addAction(getAction("metronome"));
showWave = new QAction(tr("Wave"), tb);
showWave->setToolTip(tr("show wave display"));
showWave->setCheckable(true);
showWave->setChecked(false);
connect(showWave, SIGNAL(toggled(bool)), SLOT(showWaveView(bool)));
tb->addAction(showWave);
//-------------
tb = addToolBar(tr("toolbar 2"));
static const char* sl3[] = { "voice-1", "voice-2", "voice-3", "voice-4" };
QActionGroup* voiceGroup = new QActionGroup(this);
for (const char* s : sl3) {
QAction* a = getAction(s);
a->setCheckable(true);
voiceGroup->addAction(a);
tb->addAction(getAction(s));
}
tb->addSeparator();
tb->addWidget(new QLabel(tr("Cursor:")));
pos = new Awl::PosLabel;
pos->setFrameStyle(QFrame::NoFrame | QFrame::Plain);
tb->addWidget(pos);
Awl::PitchLabel* pl = new Awl::PitchLabel();
pl->setFrameStyle(QFrame::NoFrame | QFrame::Plain);
tb->addWidget(pl);
tb->addSeparator();
tb->addWidget(new QLabel(tr("Velocity:")));
veloType = new QComboBox;
veloType->addItem(tr("offset"), MScore::OFFSET_VAL);
veloType->addItem(tr("user"), MScore::USER_VAL);
tb->addWidget(veloType);
velocity = new QSpinBox;
velocity->setRange(-1, 127);
velocity->setSpecialValueText("--");
velocity->setReadOnly(true);
tb->addWidget(velocity);
tb->addWidget(new QLabel(tr("Pitch:")));
pitch = new Awl::PitchEdit;
pitch->setReadOnly(true);
tb->addWidget(pitch);
//-------------
qreal xmag = .1;
ruler = new Ruler;
ruler->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
ruler->setFixedHeight(rulerHeight);
ruler->setMag(xmag, 1.0);
Piano* piano = new Piano;
piano->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
piano->setFixedWidth(pianoWidth);
gv = new PianoView;
gv->scale(xmag, 1.0);
gv->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
gv->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
hsb = new QScrollBar(Qt::Horizontal);
connect(gv->horizontalScrollBar(), SIGNAL(rangeChanged(int,int)),
SLOT(rangeChanged(int,int)));
// layout
QHBoxLayout* hbox = new QHBoxLayout;
//.........这里部分代码省略.........
示例7: QTabWidget
//.........这里部分代码省略.........
options->insertItem("Hide Grid", this, SLOT(hideGrid()));
options->insertSeparator();
//options->insertItem("Conic Type", this, SLOT(conicType()));
//options->insertSeparator();
options->insertItem("Unbounded Face Color...", this, SLOT(backGroundColor()));
options->insertSeparator();
options->insertItem("Edge Color...", this, SLOT(changeEdgeColor()));
options->insertSeparator();
options->insertItem("Vertex Color...", this, SLOT(changeVertexColor()));
options->insertSeparator();
options->insertItem("Point-Locaiton Strategy....", this ,
SLOT(pointLocationStrategy()));
// help menu
QPopupMenu * help = new QPopupMenu( this );
menuBar()->insertItem( "&Help", help );
help->insertItem("How To...", this, SLOT(howto()), Key_F1);
help->insertSeparator();
help->insertItem("&About...", this, SLOT(about()), CTRL+Key_A );
help->insertItem("About &Qt...", this, SLOT(aboutQt()) );
QToolBar *modeTools = new QToolBar( this, "mode operations" );
modeTools->setLabel( "Mode Operations" );
insertMode->addTo( modeTools );
deleteMode->addTo( modeTools );
dragMode->addTo( modeTools );
pointLocationMode->addTo( modeTools );
rayShootingUpMode->addTo( modeTools );
rayShootingDownMode->addTo( modeTools );
mergeMode->addTo( modeTools );
splitMode->addTo( modeTools );
fillfaceMode->addTo( modeTools );
modeTools->addSeparator();
QToolBar *snapModeTools = new QToolBar( this, "snapMode operations" );
snapModeTools->setLabel( "Snap Mode Operations" );
snapModeTools->addSeparator();
setSnapMode->addTo( snapModeTools );
setGridSnapMode->addTo( snapModeTools );
snapModeTools->addSeparator();
QToolBar *traitsTool = new QToolBar( this, "traits type" );
traitsTool->setLabel( "Traits Type" );
traitsTool->addSeparator();
setSegmentTraits->addTo( traitsTool );
setPolylineTraits->addTo( traitsTool );
#ifdef CGAL_USE_CORE
setConicTraits->addTo( traitsTool );
#endif
traitsTool->addSeparator();
QToolBar *zoomTool = new QToolBar( this, "zoom" );
zoomTool->setLabel( "Zoom" );
zoomTool->addSeparator();
zoomoutBt->addTo( zoomTool );
zoominBt->addTo( zoomTool );
zoomTool->addSeparator();
QToolBar *colorTool = new QToolBar( this, "color" );
colorTool->addSeparator();
colorTool->setLabel("Choose color");
color_dialog_bt->addTo(colorTool);
colorTool->addSeparator();
QToolBar *envelopeTool = new QToolBar( this, "envelopes" );
示例8: initUI
//.........这里部分代码省略.........
addKeyButton->setFixedSize(24, 24);
QToolButton* removeKeyButton = new QToolButton(this);
removeKeyButton->setIcon(QIcon(":icons/remove.png"));
removeKeyButton->setToolTip(tr("Remove Frame"));
removeKeyButton->setFixedSize(24, 24);
QToolButton* duplicateKeyButton = new QToolButton(this);
duplicateKeyButton->setIcon(QIcon(":icons/controls/duplicate.png"));
duplicateKeyButton->setToolTip(tr("Duplicate Frame"));
duplicateKeyButton->setFixedSize(24, 24);
QLabel* zoomLabel = new QLabel(tr("Zoom:"));
zoomLabel->setIndent(5);
QSlider* zoomSlider = new QSlider(this);
zoomSlider->setRange(4, 40);
zoomSlider->setFixedWidth(74);
zoomSlider->setValue(mTracks->getFrameSize());
zoomSlider->setToolTip(tr("Adjust frame width"));
zoomSlider->setOrientation(Qt::Horizontal);
QLabel* onionLabel = new QLabel(tr("Onion skin:"));
QToolButton* onionTypeButton = new QToolButton(this);
onionTypeButton->setIcon(QIcon(":icons/onion_type.png"));
onionTypeButton->setToolTip(tr("Toggle match keyframes"));
onionTypeButton->setFixedSize(24, 24);
timelineButtons->addWidget(keyLabel);
timelineButtons->addWidget(addKeyButton);
timelineButtons->addWidget(removeKeyButton);
timelineButtons->addWidget(duplicateKeyButton);
timelineButtons->addSeparator();
timelineButtons->addWidget(zoomLabel);
timelineButtons->addWidget(zoomSlider);
timelineButtons->addSeparator();
timelineButtons->addWidget(onionLabel);
timelineButtons->addWidget(onionTypeButton);
timelineButtons->addSeparator();
timelineButtons->setFixedHeight(30);
// --------- Time controls ---------
mTimeControls = new TimeControls(this);
mTimeControls->setEditor(editor());
mTimeControls->initUI();
mTimeControls->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
updateLength();
QHBoxLayout* rightToolBarLayout = new QHBoxLayout();
rightToolBarLayout->addWidget(timelineButtons);
rightToolBarLayout->setAlignment(Qt::AlignLeft);
rightToolBarLayout->addWidget(mTimeControls);
rightToolBarLayout->setMargin(0);
rightToolBarLayout->setSpacing(0);
rightToolBar->setLayout(rightToolBarLayout);
QGridLayout* rightLayout = new QGridLayout();
rightLayout->addWidget(rightToolBar, 0, 0);
rightLayout->addWidget(mTracks, 1, 0);
rightLayout->setMargin(0);
rightLayout->setSpacing(0);
rightWidget->setLayout(rightLayout);
// --- Splitter ---
QSplitter* splitter = new QSplitter(this);
示例9: toChangeConnection
toSGATrace::toSGATrace(QWidget *main, toConnection &connection)
: toToolWidget(SGATraceTool, "trace.html", main, connection, "toSGATrace")
{
QToolBar *toolbar = toAllocBar(this, tr("SGA trace"));
layout()->addWidget(toolbar);
FetchAct = new QAction(QPixmap(const_cast<const char**>(refresh_xpm)),
tr("Fetch statements in SGA"), this);
FetchAct->setShortcut(QKeySequence::Refresh);
connect(FetchAct, SIGNAL(triggered()), this, SLOT(refresh(void)));
toolbar->addAction(FetchAct);
toolbar->addSeparator();
QLabel * labSchema = new QLabel(tr("Schema") + " ", toolbar);
toolbar->addWidget(labSchema);
Schema = new toResultCombo(toolbar);
Schema->additionalItem(tr("Any"));
Schema->setSelected(connection.user().toUpper());
Schema->query(toSQL::sql(toSQL::TOSQL_USERLIST));
toolbar->addWidget(Schema);
connect(Schema, SIGNAL(activated(const QString &)), this, SLOT(changeSchema(const QString &)));
toolbar->addSeparator();
QLabel * labRef = new QLabel(tr("Refresh") + " ", toolbar);
toolbar->addWidget(labRef);
connect(Refresh = toRefreshCreate(toolbar, TO_TOOLBAR_WIDGET_NAME),
SIGNAL(activated(const QString &)), this, SLOT(changeRefresh(const QString &)));
toolbar->addWidget(Refresh);
toolbar->addSeparator();
QLabel * labType = new QLabel(tr("Type") + " ", toolbar);
toolbar->addWidget(labType);
Type = new QComboBox(toolbar);
Type->addItem(tr("SGA"));
Type->addItem(tr("Long operations"));
toolbar->addWidget(Type);
toolbar->addSeparator();
QLabel * labSelect = new QLabel(tr("Selection") + " ", toolbar);
toolbar->addWidget(labSelect);
Limit = new QComboBox(toolbar);
Limit->addItem(tr("All"));
Limit->addItem(tr("Unfinished"));
Limit->addItem(tr("1 execution, 1 parse"));
Limit->addItem(tr("Top executions"));
Limit->addItem(tr("Top sorts"));
Limit->addItem(tr("Top diskreads"));
Limit->addItem(tr("Top buffergets"));
Limit->addItem(tr("Top rows"));
Limit->addItem(tr("Top sorts/exec"));
Limit->addItem(tr("Top diskreads/exec"));
Limit->addItem(tr("Top buffergets/exec"));
Limit->addItem(tr("Top rows/exec"));
Limit->addItem(tr("Top buffers/row"));
toolbar->addWidget(Limit);
toolbar->addWidget(new toSpacer());
new toChangeConnection(toolbar, TO_TOOLBAR_WIDGET_NAME);
QSplitter *splitter = new QSplitter(Qt::Vertical, this);
layout()->addWidget(splitter);
Trace = new toResultTableView(false, false, splitter);
QList<int> list;
list.append(75);
splitter->setSizes(list);
Trace->setReadAll(true);
Statement = new toSGAStatement(splitter);
connect(Trace, SIGNAL(selectionChanged()),
this, SLOT(changeItem()));
CurrentSchema = connection.user().toUpper();
updateSchemas();
try
{
connect(timer(), SIGNAL(timeout(void)), this, SLOT(refresh(void)));
toRefreshParse(timer(), toConfigurationSingle::Instance().refresh());
}
TOCATCH;
setFocusProxy(Trace);
}
示例10: pixmap
PQTextEditor::PQTextEditor(QWidget* parent):
QMainWindow(parent)
{
QWidget *centralWidget = new QWidget(this);
mLayout = new QGridLayout(centralWidget);
centralWidget->setLayout(mLayout);
setCentralWidget(centralWidget);
mEditor = new QTextEdit(this);
mLayout->addWidget(mEditor, 0, 0);
connect(mEditor, SIGNAL(textChanged()), SIGNAL(textChanged()));
QAction *action;
QToolBar *toolbar = addToolBar(tr("Edit Toolbar"));
addAction(toolbar, QLatin1String("undo"), QLatin1String("edit-undo"), tr("Undo"), false, QKeySequence::Undo, mEditor, SLOT(undo()));
addAction(toolbar, QLatin1String("redo"), QLatin1String("edit-redo"), tr("Redo"), false, QKeySequence::Redo, mEditor, SLOT(redo()));
addAction(toolbar, QLatin1String("cut"), QLatin1String("edit-cut"), tr("Cut"), false,QKeySequence::Cut, mEditor, SLOT(cut()));
addAction(toolbar, QLatin1String("copy"), QLatin1String("edit-copy"), tr("Copy"), false,QKeySequence::Copy, mEditor, SLOT(copy()));
addAction(toolbar, QLatin1String("paste"), QLatin1String("edit-paste"), tr("Paste"), false,QKeySequence::Paste, mEditor, SLOT(paste()));
toolbar = addToolBar(tr("Format Toolbar"));
addAction(toolbar, QLatin1String("bold"), QLatin1String("format-text-bold"), tr("Bold"), true, QKeySequence::Bold, this, SLOT(slotToggleBold()));
addAction(toolbar, QLatin1String("italic"), QLatin1String("format-text-italic"), tr("Italic"), true, QKeySequence::Italic, this, SLOT(slotToggleItalic()));
addAction(toolbar, QLatin1String("strikethrough"), QLatin1String("format-text-strikethrough"), tr("Strikethrough"), true, QKeySequence(), this, SLOT(slotToggleStrikethrough()));
addAction(toolbar, QLatin1String("underline"), QLatin1String("format-text-underline"), tr("Underline"), true, QKeySequence::Underline, this, SLOT(slotToggleUnderline()));
toolbar->addSeparator();
QActionGroup *group = new QActionGroup(this);
group->addAction(addAction(toolbar, QLatin1String("justify-left"), QLatin1String("format-justify-left"), tr("Justify Left"), true, QKeySequence(), this, SLOT(slotJustifyLeft())));
group->addAction(addAction(toolbar, QLatin1String("justify-center"), QLatin1String("format-justify-center"), tr("Justify Center"), true, QKeySequence(), this, SLOT(slotJustifyCenter())));
group->addAction(addAction(toolbar, QLatin1String("justify-fill"), QLatin1String("format-justify-fill"), tr("Justify Fill"), true, QKeySequence(), this, SLOT(slotJustifyFill())));
group->addAction(addAction(toolbar, QLatin1String("justify-right"), QLatin1String("format-justify-right"), tr("Justify Right"), true, QKeySequence(), this, SLOT(slotJustifyRight())));
toolbar->addSeparator();
addAction(toolbar, QLatin1String("unindent"), QLatin1String("format-indent-less"), tr("Unindent"), false, QKeySequence(), this, SLOT(slotUnindent()));
addAction(toolbar, QLatin1String("indent"), QLatin1String("format-indent-more"), tr("Indent"), false, QKeySequence(), this, SLOT(slotIndent()));
mStyleComboBox = new QComboBox(this);
mStyleComboBox->addItem(tr("Standard"));
mStyleComboBox->addItem(tr("Bullet List (Disc)"));
mStyleComboBox->addItem(tr("Bullet List (Circle)"));
mStyleComboBox->addItem(tr("Bullet List (Square)"));
mStyleComboBox->addItem(tr("Ordered List (Decimal)"));
mStyleComboBox->addItem(tr("Ordered List (Alpha lower)"));
mStyleComboBox->addItem(tr("Ordered List (Alpha upper)"));
mStyleComboBox->addItem(tr("Ordered List (Roman lower)"));
mStyleComboBox->addItem(tr("Ordered List (Roman upper)"));
connect(mStyleComboBox, SIGNAL(currentIndexChanged(int)), SLOT(slotChangeStyle(int)));
mFontComboBox = new QFontComboBox(this);
connect(mFontComboBox, SIGNAL(currentFontChanged(QFont)), SLOT(slotChangeFont(QFont)));
mFontSizeComboBox = new QComboBox(this);
QFontDatabase db;
Q_FOREACH (int size, db.standardSizes()) {
mFontSizeComboBox->addItem(QString::number(size));
}
/* Initialize */
mFontSizeComboBox->setCurrentIndex(mFontSizeComboBox->findText(QString::number(QApplication::font().pointSize())));
connect(mFontSizeComboBox, SIGNAL(currentIndexChanged(int)), SLOT(slotChangeFontSize(int)));
QPixmap pixmap(16, 16);
pixmap.fill(mEditor->textColor());
QAction *colorAction = new QAction(pixmap, tr("Color"), this);
connect(colorAction, SIGNAL(triggered(bool)), SLOT(slotChangeColor()));
addToolBarBreak();
toolbar = addToolBar(tr("Font Toolbar"));
toolbar->addWidget(mStyleComboBox);
toolbar->addWidget(mFontComboBox);
toolbar->addWidget(mFontSizeComboBox);
toolbar->addAction(colorAction);
}
示例11: QDockWidget
CShaderEditor::CShaderEditor( CApplication& app, CAssetShader& shader ) :
QDockWidget( "Shader Editor", &app.GetMainFrame() ),
m_IconTable( (const char** ) ShaderEditor_xpm )
{
setAttribute(Qt::WA_DeleteOnClose);
UInt32 border = 4;
m_App = &app;
m_Shader = NULL;
m_Frame = new QWidget( this );
QAction* action = NULL;
QToolBar* toolBar = new QToolBar( m_Frame );
action = toolBar->addAction( m_IconTable.GetIcon( 0 ), "Open" );
connect( action, SIGNAL( triggered() ), this, SLOT( OnUIOpen() ) );
action = toolBar->addAction( m_IconTable.GetIcon( 1 ), "Save" );
connect( action, SIGNAL( triggered() ), this, SLOT( OnUISave() ) );
toolBar->addSeparator();
action = toolBar->addAction( m_IconTable.GetIcon( 2 ), "Undo" );
connect( action, SIGNAL( triggered() ), this, SLOT( OnUIUndo() ) );
action = toolBar->addAction( m_IconTable.GetIcon( 3 ), "Redo" );
connect( action, SIGNAL( triggered() ), this, SLOT( OnUIRedo() ) );
toolBar->addSeparator();
action = toolBar->addAction( m_IconTable.GetIcon( 4 ), "Compile" );
connect( action, SIGNAL( triggered() ), this, SLOT( OnUICompile() ) );
m_TextEdit[nShaderProgramType_Vertex] = new QTextEdit( m_Frame);
m_TextEdit[nShaderProgramType_Vertex]->setUndoRedoEnabled( TRUE );
m_TextEdit[nShaderProgramType_Vertex]->setTabStopWidth( QFontMetrics( m_TextEdit[nShaderProgramType_Vertex]->currentFont( ) ).width(' ') * 4 );
CShaderEditorSyntaxHighlighter* highlighterVertex = new CShaderEditorSyntaxHighlighter(m_TextEdit[nShaderProgramType_Vertex]->document());
m_TextEdit[nShaderProgramType_Pixel] = new QTextEdit( m_Frame);
m_TextEdit[nShaderProgramType_Pixel]->setUndoRedoEnabled( TRUE );
m_TextEdit[nShaderProgramType_Pixel]->setTabStopWidth( QFontMetrics( m_TextEdit[nShaderProgramType_Pixel]->currentFont( ) ).width(' ') * 4 );
CShaderEditorSyntaxHighlighter* highlighterPixel = new CShaderEditorSyntaxHighlighter(m_TextEdit[nShaderProgramType_Pixel]->document());
m_TextEdit[nShaderProgramType_Geometry] = new QTextEdit( m_Frame);
m_TextEdit[nShaderProgramType_Geometry]->setUndoRedoEnabled( TRUE );
m_TextEdit[nShaderProgramType_Geometry]->setTabStopWidth( QFontMetrics( m_TextEdit[nShaderProgramType_Geometry]->currentFont( ) ).width(' ') * 4 );
CShaderEditorSyntaxHighlighter* highlighterGeometry = new CShaderEditorSyntaxHighlighter(m_TextEdit[nShaderProgramType_Geometry]->document());
m_TabWidget = new QTabWidget( m_Frame );
m_TabWidget->addTab( m_TextEdit[nShaderProgramType_Vertex], "Vertex Program" );
m_TabWidget->addTab( m_TextEdit[nShaderProgramType_Pixel], "Pixel Program" );
m_TabWidget->addTab( m_TextEdit[nShaderProgramType_Geometry], "Geometry Program" );
m_CurrentProgramEdited = nShaderProgramType_Vertex;
connect( m_TabWidget, SIGNAL( currentChanged( int ) ), this, SLOT( OnUITabChanged( int ) ) );
m_LogWindow = new QListWidget( m_Frame );
m_LogWindow->setVerticalScrollMode( QAbstractItemView::ScrollPerPixel );
connect( m_LogWindow, SIGNAL( itemDoubleClicked ( QListWidgetItem*) ), this, SLOT( OnUISelectError( QListWidgetItem* ) ) );
QSplitter* splitter = new QSplitter( Qt::Vertical, m_Frame );
splitter->addWidget( m_TabWidget );
splitter->addWidget( m_LogWindow );
splitter->setStretchFactor( 0, 4 );
splitter->setStretchFactor( 1, 1 );
QVBoxLayout *layout = new QVBoxLayout( m_Frame );
layout->addWidget( toolBar );
layout->addWidget( splitter );
layout->setContentsMargins( 0, 0, 0, 0 );
m_Frame->setLayout( layout ); // use the sizer for layout
setWidget( m_Frame );
resize( QSize( 800, 600 ) );
SetShader( shader );
}
示例12: show
void Mainframe::show()
{
// prevent multiple inserting of menu entries, by calls of showFullScreen(), ...
if (preferences_action_ != 0)
{
MainControl::show();
return;
}
QToolBar* tb = NULL;
if (UIOperationMode::instance().getMode() <= UIOperationMode::MODE_ADVANCED)
{
tb = new QToolBar("Main Toolbar", this);
tb->setObjectName("Main Toolbar");
tb->setIconSize(QSize(22,22));
addToolBar(Qt::TopToolBarArea, tb);
}
MainControl::show();
QMenu *menu = initPopupMenu(MainControl::WINDOWS, UIOperationMode::MODE_ADVANCED);
if (menu)
{
menu->addSeparator();
menu->addAction(tb->toggleViewAction());
}
// NOTE: this *has* to be run... a null pointer is unproblematic
if (UIOperationMode::instance().getMode() <= UIOperationMode::MODE_ADVANCED)
{
MolecularFileDialog::getInstance(0)->addToolBarEntries(tb);
DownloadPDBFile::getInstance(0)->addToolBarEntries(tb);
DownloadElectronDensity::getInstance(0)->addToolBarEntries(tb);
PubChemDialog::getInstance(0)->addToolBarEntries(tb);
UndoManagerDialog::getInstance(0)->addToolBarEntries(tb);
tb->addAction(fullscreen_action_);
Path path;
IconLoader& loader = IconLoader::instance();
qload_action_ = new QAction(loader.getIcon("actions/quickopen-file"), tr("quickload"), this);
qload_action_->setObjectName("quickload");
connect(qload_action_, SIGNAL(triggered()), this, SLOT(quickLoadConfirm()));
HelpViewer::getInstance("BALLView Docu")->registerForHelpSystem(qload_action_, "tips.html#quickload");
tb->addAction(qload_action_);
qsave_action_ = new QAction(loader.getIcon("actions/quicksave"), tr("quicksave"), this);
qsave_action_->setObjectName("quicksave");
connect(qsave_action_, SIGNAL(triggered()), this, SLOT(quickSave()));
HelpViewer::getInstance("BALLView Docu")->registerForHelpSystem(qsave_action_, "tips.html#quickload");
tb->addAction(qsave_action_);
tb->addSeparator();
DisplayProperties::getInstance(0)->addToolBarEntries(tb);
MolecularStructure::getInstance(0)->addToolBarEntries(tb);
}
scene_->addToolBarEntries(tb);
if (UIOperationMode::instance().getMode() <= UIOperationMode::MODE_ADVANCED)
{
tb->addAction(stop_simulation_action_);
tb->addAction(preferences_action_);
HelpViewer::getInstance("BALLView Docu")->addToolBarEntries(tb);
}
// we have changed the child widgets stored in the maincontrol (e.g. toolbars), so we have
// to restore the window state again!
restoreWindows();
}
示例13: setupActions
void QucsHelp::setupActions()
{
QToolBar *toolbar = new QToolBar("main_toolbar",this);
this->addToolBar(toolbar);
const QKeySequence ks = QKeySequence();
QAction *quitAction = new QAction(QIcon((":/bitmaps/quit.png")),
tr("&Quit"), this);
quitAction->setShortcut((const QKeySequence&)Qt::CTRL+Qt::Key_Q);
QAction *backAction = new QAction(QIcon((":/bitmaps/back.png")),
tr("&Back"), this);
backAction->setShortcut( Qt::ALT+Qt::Key_Left);
QAction *forwardAction = new QAction(QIcon((":/bitmaps/forward.png")),
tr("&Forward"), this);
forwardAction->setShortcut(Qt::ALT+Qt::Key_Right);
QAction *homeAction = new QAction(QIcon((":/bitmaps/home.png")),
tr("&Home"),this);
homeAction->setShortcut(Qt::CTRL+Qt::Key_H);
previousAction = new QAction(QIcon((":/bitmaps/previous.png")),tr("&Previous"),
this);
previousAction->setShortcut( ks);
nextAction = new QAction(QIcon((":/bitmaps/next.png")),
tr("&Next"), this);
nextAction->setShortcut( ks);
viewBrowseDock = new QAction(tr("&Table of Contents"), this);
viewBrowseDock->setCheckable(true);
viewBrowseDock->setChecked(true);
viewBrowseDock->setStatusTip(tr("Enables/disables the table of contents"));
viewBrowseDock->setWhatsThis(tr("Table of Contents\n\nEnables/disables the table of contents"));
connect(quitAction,SIGNAL(activated()),qApp,SLOT(quit()));
connect(backAction,SIGNAL(activated()),textBrowser,SLOT(backward()));
connect(textBrowser,SIGNAL(backwardAvailable(bool)),backAction,SLOT(setEnabled(bool)));
connect(forwardAction,SIGNAL(activated()),textBrowser,SLOT(forward()));
connect(textBrowser,SIGNAL(forwardAvailable(bool)),forwardAction,SLOT(setEnabled(bool)));
connect(homeAction,SIGNAL(activated()),textBrowser,SLOT(home()));
connect(homeAction,SIGNAL(activated()),this,SLOT(gohome()));
connect(textBrowser,SIGNAL(sourceChanged(const QUrl &)),this,SLOT(slotSourceChanged(const QUrl &)));
connect(previousAction,SIGNAL(activated()),this,SLOT(previousLink()));
connect(nextAction,SIGNAL(activated()),this,SLOT(nextLink()));
connect(viewBrowseDock, SIGNAL(toggled(bool)), SLOT(slotToggleSidebar(bool)));
toolbar->addAction(backAction);
toolbar->addAction(forwardAction);
toolbar->addSeparator();
toolbar->addAction(homeAction);
toolbar->addAction(previousAction);
toolbar->addAction(nextAction);
toolbar->addSeparator();
toolbar->addAction(quitAction);
QMenu *fileMenu = menuBar()->addMenu(tr("&File"));
fileMenu->addAction(quitAction);
fileMenu->addAction(quitAction);
QMenu *viewMenu = menuBar()->addMenu(tr("&View"));
viewMenu->addAction(backAction);
viewMenu->addAction(forwardAction);
viewMenu->addAction(homeAction);
viewMenu->addAction(previousAction);
viewMenu->addAction(nextAction);
viewMenu->addSeparator();
viewMenu->addAction(viewBrowseDock);
QMenu *helpMenu = menuBar()->addMenu(tr("&Help"));
helpMenu->addAction(tr("&About Qt"),qApp,SLOT(aboutQt()));
}
示例14: setup
void FileMainWindow::setup()
{
QSplitter *splitter = new QSplitter( this );
dirlist = new DirectoryView( splitter, "dirlist", TRUE );
dirlist->addColumn( "Name" );
dirlist->addColumn( "Type" );
Directory *root = new Directory( dirlist, "/" );
root->setOpen( TRUE );
splitter->setResizeMode( dirlist, QSplitter::KeepSize );
fileview = new QtFileIconView( "/", splitter );
fileview->setSelectionMode( QIconView::Extended );
setCentralWidget( splitter );
QToolBar *toolbar = new QToolBar( this, "toolbar" );
setRightJustification( TRUE );
(void)new QLabel( tr( " Path: " ), toolbar );
pathCombo = new QComboBox( TRUE, toolbar );
pathCombo->setAutoCompletion( TRUE );
toolbar->setStretchableWidget( pathCombo );
connect( pathCombo, SIGNAL( activated( const QString & ) ),
this, SLOT ( changePath( const QString & ) ) );
toolbar->addSeparator();
QPixmap pix;
pix = QPixmap( cdtoparent_xpm );
upButton = new QToolButton( pix, "One directory up", QString::null,
this, SLOT( cdUp() ), toolbar, "cd up" );
pix = QPixmap( newfolder_xpm );
mkdirButton = new QToolButton( pix, "New Folder", QString::null,
this, SLOT( newFolder() ), toolbar, "new folder" );
connect( dirlist, SIGNAL( folderSelected( const QString & ) ),
fileview, SLOT ( setDirectory( const QString & ) ) );
connect( fileview, SIGNAL( directoryChanged( const QString & ) ),
this, SLOT( directoryChanged( const QString & ) ) );
connect( fileview, SIGNAL( startReadDir( int ) ),
this, SLOT( slotStartReadDir( int ) ) );
connect( fileview, SIGNAL( readNextDir() ),
this, SLOT( slotReadNextDir() ) );
connect( fileview, SIGNAL( readDirDone() ),
this, SLOT( slotReadDirDone() ) );
setDockEnabled( DockLeft, FALSE );
setDockEnabled( DockRight, FALSE );
label = new QLabel( statusBar() );
statusBar()->addWidget( label, 2, TRUE );
progress = new QProgressBar( statusBar() );
statusBar()->addWidget( progress, 1, TRUE );
connect( fileview, SIGNAL( enableUp() ),
this, SLOT( enableUp() ) );
connect( fileview, SIGNAL( disableUp() ),
this, SLOT( disableUp() ) );
connect( fileview, SIGNAL( enableMkdir() ),
this, SLOT( enableMkdir() ) );
connect( fileview, SIGNAL( disableMkdir() ),
this, SLOT( disableMkdir() ) );
}
示例15: toToolWidget
toPLSQLEditor::toPLSQLEditor(QWidget *main, toConnection &connection)
: toToolWidget(PLSQLEditorTool, "plsqleditor.html", main, connection, "toPLSQLEditor")
{
createActions();
QToolBar *toolbar = toAllocBar(this, tr("PLSQLEditor"));
layout()->addWidget(toolbar);
toolbar->addAction(refreshAct);
toolbar->addSeparator();
Schema = new QComboBox(toolbar);
Schema->setObjectName("PLSQLEditorSchemaCombo");
toolbar->addWidget(Schema);
connect(Schema,
SIGNAL(activated(int)),
this,
SLOT(changeSchema(int)));
toolbar->addSeparator();
toolbar->addAction(newSheetAct);
toolbar->addAction(compileAct);
toolbar->addAction(compileWarnAct);
// only show static check button when static checker is specified
if (!toConfigurationSingle::Instance().staticChecker().isEmpty())
{
toolbar->addAction(checkCodeAct);
}
toolbar->addSeparator();
toolbar->addAction(nextErrorAct);
toolbar->addAction(previousErrorAct);
toolbar->addAction(describeAct);
toolbar->addWidget(new toSpacer());
splitter = new QSplitter(Qt::Horizontal, this);
layout()->addWidget(splitter);
Objects = new QTreeView(splitter);
CodeModel = new toCodeModel(Objects);
Objects->setModel(CodeModel);
QString selected = Schema->currentText();
if (!selected.isEmpty())
CodeModel->refresh(connection, selected);
// even better (?) for reopening the tabs
// connect(Objects->selectionModel(),
// SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)),
// this,
// SLOT(changePackage(const QModelIndex &, const QModelIndex &)));
connect(Objects, SIGNAL(doubleClicked(const QModelIndex &)),
this, SLOT(changePackage(const QModelIndex &)));
splitter->addWidget(Objects);
Editors = new QTabWidget(this);
#if QT_VERSION >= 0x040500
Editors->setTabsClosable(true);
connect(Editors, SIGNAL(tabCloseRequested(int)),
this, SLOT(closeEditor(int)));
#endif
splitter->addWidget(Editors);
Editors->setTabPosition(QTabWidget::North);
QToolButton *closeButton = new toPopupButton(Editors);
closeButton->setIcon(QPixmap(const_cast<const char**>(close_xpm)));
closeButton->setFixedSize(20, 18);
// HACK: disable closing the editor tabs with the global shortcut.
// it raises: "QAction::eventFilter: Ambiguous shortcut overload: Ctrl+W"
// on some systems. But it rejects to close unfinished.unsaved work.
// - <[email protected]>
closeButton->setShortcut(QKeySequence::Close);
connect(closeButton, SIGNAL(clicked()), this, SLOT(closeEditor()));
Editors->setCornerWidget(closeButton);
setFocusProxy(Editors);
newSheet();
ToolMenu = NULL;
connect(toMainWidget()->workspace(), SIGNAL(subWindowActivated(QMdiSubWindow *)),
this, SLOT(windowActivated(QMdiSubWindow *)));
QSettings s;
s.beginGroup("toPLSQLEditor");
splitter->restoreState(s.value("splitter").toByteArray());
s.endGroup();
conn = &connection;
refresh();
}