当前位置: 首页>>代码示例>>C++>>正文


C++ QToolBar类代码示例

本文整理汇总了C++中QToolBar的典型用法代码示例。如果您正苦于以下问题:C++ QToolBar类的具体用法?C++ QToolBar怎么用?C++ QToolBar使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了QToolBar类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: QObject

GolangPresentEdit::GolangPresentEdit(LiteApi::IApplication *app, LiteApi::IEditor *editor, QObject *parent) :
    QObject(parent), m_liteApp(app), m_htmldoc(0), m_process(0)
{
    m_editor = LiteApi::getLiteEditor(editor);
    if (!m_editor) {
        return;
    }
    m_ed = LiteApi::getPlainTextEdit(editor);
    m_editor->setWordWrap(true);

    connect(m_liteApp->editorManager(),SIGNAL(editorSaved(LiteApi::IEditor*)),this,SLOT(editorSaved(LiteApi::IEditor*)));

    LiteApi::IActionContext *actionContext = m_liteApp->actionManager()->getActionContext(this,"GoSlide");

    QAction *s1 = new QAction(QIcon("icon:golangpresent/images/s1.png"),tr("Section (s1)"),this);
    actionContext->regAction(s1,"Section","Ctrl+1");

    QAction *s2 = new QAction(QIcon("icon:golangpresent/images/s2.png"),tr("Subsection (s2)"),this);
    actionContext->regAction(s2,"Subsection","Ctrl+2");

    QAction *s3 = new QAction(QIcon("icon:golangpresent/images/s3.png"),tr("Sub-subsection (s3)"),this);
    actionContext->regAction(s3,"Sub-subsection","Ctrl+3");

    QAction *bold = new QAction(QIcon("icon:golangpresent/images/bold.png"),tr("Bold"),this);
    actionContext->regAction(bold,"Bold",QKeySequence::Bold);

    QAction *italic = new QAction(QIcon("icon:golangpresent/images/italic.png"),tr("Italic"),this);
    actionContext->regAction(italic,"Italic",QKeySequence::Italic);

    QAction *code = new QAction(QIcon("icon:golangpresent/images/code.png"),tr("Inline Code"),this);
    actionContext->regAction(code,"InlineCode","Ctrl+K");

    QAction *bullets = new QAction(QIcon("icon:golangpresent/images/bullets.png"),tr("Switch Bullets"),this);
    actionContext->regAction(bullets,"Switch Bullets","Ctrl+Shift+U");

    QAction *comment = new QAction(tr("Comment/Uncomment Selection"),this);
    actionContext->regAction(comment,"Comment","Ctrl+/");

    QAction *exportHtml = new QAction(QIcon("icon:golangpresent/images/exporthtml.png"),tr("Export HTML"),this);
    actionContext->regAction(exportHtml,"Export HTML","");

    QAction *verify = new QAction(QIcon("icon:golangpresent/images/verify.png"),tr("Verify Present"),this);
    actionContext->regAction(verify,"Verify Present","");

    //QAction *exportPdf = new QAction(QIcon("icon:golangpresent/images/exportpdf.png"),tr("Export PDF"),this);
    //actionContext->regAction(exportPdf,"Export PDF","");

    connect(m_editor,SIGNAL(destroyed()),this,SLOT(deleteLater()));
    connect(s1,SIGNAL(triggered()),this,SLOT(s1()));
    connect(s2,SIGNAL(triggered()),this,SLOT(s2()));
    connect(s3,SIGNAL(triggered()),this,SLOT(s3()));
    connect(bold,SIGNAL(triggered()),this,SLOT(bold()));
    connect(italic,SIGNAL(triggered()),this,SLOT(italic()));
    connect(code,SIGNAL(triggered()),this,SLOT(code()));
    connect(bullets,SIGNAL(triggered()),this,SLOT(bullets()));
    connect(comment,SIGNAL(triggered()),this,SLOT(comment()));
    connect(exportHtml,SIGNAL(triggered()),this,SLOT(exportHtml()));
    connect(verify,SIGNAL(triggered()),this,SLOT(verify()));
    //connect(exportPdf,SIGNAL(triggered()),this,SLOT(exportPdf()));

    QToolBar *toolBar = LiteApi::findExtensionObject<QToolBar*>(editor,"LiteApi.QToolBar");
    if (toolBar) {
        toolBar->addSeparator();
        toolBar->addAction(s1);
        toolBar->addAction(s2);
        toolBar->addAction(s3);
        toolBar->addSeparator();
        toolBar->addAction(bold);
        toolBar->addAction(italic);
        toolBar->addAction(code);
        toolBar->addSeparator();
        toolBar->addAction(bullets);
        toolBar->addSeparator();
        toolBar->addAction(verify);
        toolBar->addSeparator();
        toolBar->addAction(exportHtml);
        //toolBar->addAction(exportPdf);
    }

    QMenu *menu = LiteApi::getEditMenu(editor);
    if (menu) {
        menu->addSeparator();
        menu->addAction(s1);
        menu->addAction(s2);
        menu->addAction(s3);
        menu->addSeparator();
        menu->addAction(bold);
        menu->addAction(italic);
        menu->addAction(code);
        menu->addSeparator();
        menu->addAction(bullets);
        menu->addSeparator();
        menu->addAction(comment);
        menu->addSeparator();
        menu->addAction(verify);
        menu->addSeparator();
        menu->addAction(exportHtml);
        //menu->addAction(exportPdf);
    }

//.........这里部分代码省略.........
开发者ID:gurjeet,项目名称:liteide,代码行数:101,代码来源:golangpresentedit.cpp

示例2: QMainWindow

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    pDetectorProgress = NULL;
    mLogAllXmlRpcOutput = false;
    mDbUpdated = false;
    // mSyncRequests tracks how many sync requests have been made
    // in order to know when to re-enable the widgets
    mSyncRequests = 0;
    // mSyncPosition is used to iterate through the backend list,
    // so we only sync one repository at a time, rather than flinging
    // requests at all of them at once.
    mSyncPosition = 0;
    mUploading = false;
    QSettings settings("Entomologist");

    pManager = new QNetworkAccessManager();
    connect(pManager, SIGNAL(sslErrors(QNetworkReply *, const QList<QSslError> &)),
            this, SLOT(handleSslErrors(QNetworkReply *, const QList<QSslError> &)));

    ui->setupUi(this);

    QToolBar *toolBar = new QToolBar("Main Toolbar");
    toolBar->setObjectName("Main ToolBar");
    toolBar->setIconSize(QSize(32,32));
    refreshButton = toolBar->addAction(style()->standardIcon(QStyle::SP_BrowserReload), "");
    refreshButton->setToolTip("Resync all trackers");
    uploadButton = toolBar->addAction(style()->standardIcon(QStyle::SP_ArrowUp), "");
    uploadButton->setToolTip("Upload changes");
    changelogButton = toolBar->addAction(style()->standardIcon(QStyle::SP_FileDialogInfoView), "");
    changelogButton->setToolTip("Show changelog");
    toolBar->setMovable(false);
    addToolBar(Qt::TopToolBarArea, toolBar);


    setupTrayIcon();
    // Setup the "Show" menu and "Work Offline"
    ui->actionMy_Bugs->setChecked(settings.value("show-my-bugs", true).toBool());
    ui->actionMy_Reports->setChecked(settings.value("show-my-reports", true).toBool());
    ui->actionMy_CCs->setChecked(settings.value("show-my-ccs", true).toBool());
    ui->actionMonitored_Components->setChecked(settings.value("show-my-monitored", true).toBool());
    ui->action_Work_Offline->setChecked(settings.value("work-offline", false).toBool());

    // Set the default network status
    pStatusIcon = new QLabel();
    pStatusIcon->setPixmap(QPixmap(":/online"));
    pStatusMessage = new QLabel("");
    ui->statusBar->addPermanentWidget(pStatusMessage);
    ui->statusBar->addPermanentWidget(pStatusIcon);

    // We use a spinner animation to show that we're doing things
    pSpinnerMovie = new QMovie(this);
    pSpinnerMovie->setFileName(":/spinner");
    pSpinnerMovie->setScaledSize(QSize(48,48));
    ui->spinnerLabel->setMovie(pSpinnerMovie);
    ui->spinnerLabel->hide();
    ui->syncingLabel->hide();

    // Set up the resync timer
    pUpdateTimer = new QTimer(this);
    connect(pUpdateTimer, SIGNAL(timeout()),
            this, SLOT(resync()));
    setTimer();

    // Keyboard shortcuts for search bar focus / upload changes.
    QShortcut* searchFocus;
    QShortcut* uploadChange;
    QShortcut *logXmlRpc;

    searchFocus = new QShortcut(QKeySequence(Qt::META + Qt::Key_Space),this);
    searchFocus->setContext(Qt::ApplicationShortcut);
    connect(searchFocus,SIGNAL(activated()),this,SLOT(searchFocusTriggered()));

    uploadChange = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_S),this);
    uploadChange->setContext(Qt::ApplicationShortcut);
    connect(uploadChange,SIGNAL(activated()),this,SLOT(upload()));

    logXmlRpc = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_0), this);
    logXmlRpc->setContext(Qt::ApplicationShortcut);
    connect(logXmlRpc, SIGNAL(activated()), this, SLOT(toggleXmlRpcLogging()));

    // Menu actions
    connect(ui->action_Add_Tracker, SIGNAL(triggered()),
            this, SLOT(addTrackerTriggered()));
    connect(ui->action_Refresh_Tracker,SIGNAL(triggered()),
            this, SLOT(resync()));
    connect(ui->actionShow_ToDo_List, SIGNAL(triggered()),
            this, SLOT(showTodoList()));
    connect(ui->action_About, SIGNAL(triggered()),
            this, SLOT(aboutTriggered()));
    connect(ui->action_Web_Site, SIGNAL(triggered()),
            this, SLOT(websiteTriggered()));
    connect(ui->action_Preferences, SIGNAL(triggered()),
            this, SLOT(prefsTriggered()));
    connect(ui->action_Quit, SIGNAL(triggered()),
            this, SLOT(quitEvent()));
    connect(ui->actionMy_Bugs, SIGNAL(triggered()),
            this, SLOT(showActionTriggered()));
    connect(ui->actionMy_CCs, SIGNAL(triggered()),
//.........这里部分代码省略.........
开发者ID:Entomologist,项目名称:entomologist,代码行数:101,代码来源:MainWindow.cpp

示例3: addActions

void EventLog::addActions(QToolBar& bar)
{
    bar.addAction(ui_.actionClearLog);
}
开发者ID:ensisoft,项目名称:newsflash-plus,代码行数:4,代码来源:eventlog.cpp

示例4: QMainWindow

kernelinfo::kernelinfo()
    : QMainWindow( 0, "kernelinfo", WDestructiveClose )
{
    printer = new QPrinter;
    QPixmap openIcon, saveIcon, printIcon;

    QToolBar * fileTools = new QToolBar( this, "file operations" );
    fileTools->setLabel( tr("File Operations") );

    openIcon = QPixmap( fileopen );
    QToolButton * fileOpen
	= new QToolButton( openIcon, tr("Open File"), QString::null,
			   this, SLOT(choose()), fileTools, "open file" );

    saveIcon = QPixmap( filesave );
    QToolButton * fileSave
	= new QToolButton( saveIcon, tr("Save File"), QString::null,
			   this, SLOT(save()), fileTools, "save file" );

    printIcon = QPixmap( fileprint );
    QToolButton * filePrint
	= new QToolButton( printIcon, tr("Print File"), QString::null,
			   this, SLOT(print()), fileTools, "print file" );


    (void)QWhatsThis::whatsThisButton( fileTools );

    QString fileOpenText = tr("<p><img source=\"fileopen\"> "
	         "Click this button to open a <em>new file</em>. <br>"
                 "You can also select the <b>Open</b> command "
                 "from the <b>File</b> menu.</p>");

    QWhatsThis::add( fileOpen, fileOpenText );

    QMimeSourceFactory::defaultFactory()->setPixmap( "fileopen", openIcon );

    QString fileSaveText = tr("<p>Click this button to save the file you "
                 "are editing. You will be prompted for a file name.\n"
                 "You can also select the <b>Save</b> command "
                 "from the <b>File</b> menu.</p>");

    QWhatsThis::add( fileSave, fileSaveText );

    QString filePrintText = tr("Click this button to print the file you "
                 "are editing.\n You can also select the Print "
                 "command from the File menu.");

    QWhatsThis::add( filePrint, filePrintText );


    QPopupMenu * file = new QPopupMenu( this );
    menuBar()->insertItem( tr("&File"), file );


    file->insertItem( tr("&New"), this, SLOT(newDoc()), CTRL+Key_N );

    int id;
    id = file->insertItem( openIcon, tr("&Open..."),
			   this, SLOT(choose()), CTRL+Key_O );
    file->setWhatsThis( id, fileOpenText );

    id = file->insertItem( saveIcon, tr("&Save"),
			   this, SLOT(save()), CTRL+Key_S );
    file->setWhatsThis( id, fileSaveText );

    id = file->insertItem( tr("Save &As..."), this, SLOT(saveAs()) );
    file->setWhatsThis( id, fileSaveText );

    file->insertSeparator();

    id = file->insertItem( printIcon, tr("&Print..."),
			   this, SLOT(print()), CTRL+Key_P );
    file->setWhatsThis( id, filePrintText );

    file->insertSeparator();

    file->insertItem( tr("&Close"), this, SLOT(close()), CTRL+Key_W );

    file->insertItem( tr("&Quit"), qApp, SLOT( closeAllWindows() ), CTRL+Key_Q );

    menuBar()->insertSeparator();

    QPopupMenu * help = new QPopupMenu( this );
    menuBar()->insertItem( tr("&Help"), help );

    help->insertItem( tr("&About"), this, SLOT(about()), Key_F1 );
    help->insertItem( tr("About &Qt"), this, SLOT(aboutQt()) );
    help->insertSeparator();
    help->insertItem( tr("What's &This"), this, SLOT(whatsThis()), SHIFT+Key_F1 );

    e = new QTextEdit( this, "editor" );
    e->setFocus();
    setCentralWidget( e );
    statusBar()->message( tr("Ready"), 2000 );

    resize( 450, 600 );
}
开发者ID:Jona0712,项目名称:proyectos-kreig-usac,代码行数:97,代码来源:kernelinfo.cpp

示例5: switch

void WindowsModernStyle::drawComplexControl( ComplexControl control, const QStyleOptionComplex* option,
	QPainter* painter, const QWidget* widget ) const
{
	switch ( control ) {
		case CC_ToolButton: {
			QToolBar* toolBar;
			if ( widget && ( toolBar = qobject_cast<QToolBar*>( widget->parentWidget() ) ) ) {
				if ( const QStyleOptionToolButton* optionToolButton = qstyleoption_cast<const QStyleOptionToolButton*>( option ) ) {
					QRect buttonRect = subControlRect( control, option, SC_ToolButton, widget );
					QStyle::State buttonState = option->state & ~State_Sunken;
					if ( option->state & State_Sunken ) {
						if ( optionToolButton->activeSubControls & SC_ToolButton )
							buttonState |= State_Sunken;
						else if ( optionToolButton->activeSubControls & SC_ToolButtonMenu )
							buttonState |= State_MouseOver;
					}
					bool selected = buttonState & State_MouseOver && option->state & State_Enabled;
					bool checked = buttonState & State_On;
					bool sunken = buttonState & State_Sunken;
					if ( selected || checked || sunken ) {
						QRect rect = buttonRect.adjusted( 0, 0, -1, -1 );
						painter->setPen( m_colorItemBorder );
						QLinearGradient gradient;
						if ( toolBar->orientation() == Qt::Vertical )
							gradient = QLinearGradient( rect.topLeft(), rect.topRight() );
						else
							gradient = QLinearGradient( rect.topLeft(), rect.bottomLeft() );
						if ( sunken || (selected && checked) ) {
							gradient.setColorAt( 0.0, m_colorItemSunkenBegin );
							gradient.setColorAt( 0.5, m_colorItemSunkenMiddle );
							gradient.setColorAt( 1.0, m_colorItemSunkenEnd );
						} else if ( checked ) {
							gradient.setColorAt( 0.0, m_colorItemCheckedBegin );
							gradient.setColorAt( 0.5, m_colorItemCheckedMiddle );
							gradient.setColorAt( 1.0, m_colorItemCheckedEnd );
						} else {
							gradient.setColorAt( 0.0, m_colorItemBackgroundBegin );
							gradient.setColorAt( 0.5, m_colorItemBackgroundMiddle );
							gradient.setColorAt( 1.0, m_colorItemBackgroundEnd );
						}
						painter->setBrush( gradient );
						painter->drawRect( rect );
					}
					QStyleOptionToolButton optionLabel = *optionToolButton;
					int fw = pixelMetric( PM_DefaultFrameWidth, option, widget );
					optionLabel.rect = buttonRect.adjusted( fw, fw, -fw, -fw );
					drawControl( CE_ToolButtonLabel, &optionLabel, painter, widget );
					if ( optionToolButton->subControls & SC_ToolButtonMenu ) {
						QStyleOption optionMenu = *optionToolButton;
						optionMenu.rect = subControlRect( control, option, SC_ToolButtonMenu, widget );
						optionMenu.state = optionToolButton->state & ~State_Sunken;
						if ( optionToolButton->state & State_Sunken ) {
							if ( optionToolButton->activeSubControls & SC_ToolButton )
								optionMenu.state |= State_MouseOver | State_Sunken;
							else if ( optionToolButton->activeSubControls & SC_ToolButtonMenu )
								optionMenu.state |= State_Sunken;
						}
						drawPrimitive( PE_IndicatorButtonDropDown, &optionMenu, painter, widget );
					} else if ( optionToolButton->features & QStyleOptionToolButton::HasMenu ) {
						int size = pixelMetric( PM_MenuButtonIndicator, option, widget );
						QRect rect = optionToolButton->rect;
						QStyleOptionToolButton optionArrow = *optionToolButton;
						optionArrow.rect = QRect( rect.right() + 4 - size, rect.height() - size + 4, size - 5, size - 5 );
						drawPrimitive( PE_IndicatorArrowDown, &optionArrow, painter, widget );
					}
					return;
				}
			}
			break;
		}

		default:
			break;
	}

	if ( useVista() )
		QWindowsVistaStyle::drawComplexControl( control, option, painter, widget );
	else
		QWindowsXPStyle::drawComplexControl( control, option, painter, widget );
}
开发者ID:ArtemKopylov,项目名称:qreal,代码行数:80,代码来源:windowsmodernstyle.cpp

示例6: QAction

void LunarMainWindow::initActions()
{
    m_actionImport          = new QAction(tr("Import"), this);
    m_actionExport          = new QAction(tr("Export"), this);
    m_actionQuit            = new QAction(tr("Quit"), this);

    m_actionNewGame         = new QAction(tr("New game"), this);
    m_actionEditGame        = new QAction(tr("Edit game"), this);
    m_actionDeleteGame      = new QAction(tr("Delete game"), this);
    m_actionLaunchGame      = new QAction(tr("Launch game"), this);
    //m_actionUninstallGame   = new QAction(tr("Uninstall game"), this);
    m_actionShowEmulators = new QAction(tr("Show Emulators"), this);

    m_actionProcessManager  = new QAction(tr("Process manager"), this);
    m_actionPlugins         = new QAction(tr("Plugins"), this);
    m_actionOptions         = new QAction(tr("Options"), this);

    m_actionAboutLunar      = new QAction(tr("About Lunar"), this);
    m_actionAboutQt         = new QAction(tr("About Qt"), this);

    m_actionQuit->setIcon(QIcon(QPixmap("resources/imgs/quit.png")));

    m_actionNewGame->setIcon(QIcon(QPixmap("resources/imgs/add_game.png")));

    m_actionEditGame->setDisabled(true);
    m_actionEditGame->setIcon(QIcon(QPixmap("resources/imgs/edit_game.png")));

    m_actionDeleteGame->setDisabled(true);
    m_actionDeleteGame->setIcon(QIcon(QPixmap("resources/imgs/delete_game.png")));

    m_actionLaunchGame->setDisabled(true);
    m_actionLaunchGame->setIcon(QIcon(QPixmap("resources/imgs/launch.png")));
    m_actionLaunchGame->setToolTip(tr("Start selected game"));

    m_actionShowEmulators->setIcon(QIcon(QPixmap("resources/imgs/emulators.png")));

    /*m_actionUninstallGame->setDisabled(true);
    m_actionUninstallGame->setIcon(QIcon(QPixmap("resources/imgs/uninstall.png")));
    m_actionUninstallGame->setToolTip(tr("Uninstall selected game if the option was previously set"));*/

    m_actionImport->setIcon(QIcon(QPixmap("resources/imgs/import.png")));
    m_actionExport->setIcon(QIcon(QPixmap("resources/imgs/export.png")));

    m_actionOptions->setIcon(QIcon(QPixmap("resources/imgs/settings.png")));
    m_actionProcessManager->setIcon(QIcon(QPixmap("resources/imgs/process.png")));
    m_actionPlugins->setIcon(QIcon(QPixmap("resources/imgs/plugin.png")));

    QToolBar *toolbar = addToolBar("Main");
    toolbar->setMinimumHeight(48);
    toolbar->setIconSize(QSize(32, 32));
    toolbar->setMovable(false);

    toolbar->addAction(m_actionNewGame);
    toolbar->addAction(m_actionEditGame);
    toolbar->addAction(m_actionDeleteGame);

    toolbar->addSeparator();
    toolbar->addAction(m_actionShowEmulators);
    /*toolbar->addAction(m_actionUninstallGame);*/

    toolbar->addSeparator();
    toolbar->addAction(m_actionProcessManager);
    toolbar->addSeparator();

    toolbar->addAction(m_actionLaunchGame);
}
开发者ID:Veltarn,项目名称:lunar,代码行数:66,代码来源:lunarmainwindow.cpp

示例7: QMainWindow

PluginCreator::PluginCreator(QWidget* parent)
   : QMainWindow(parent)
      {
      state       = S_INIT;
      item        = 0;
      view        = 0;
      dock        = 0;
      manualDock  = 0;
      helpBrowser = 0;

      setupUi(this);

      QToolBar* fileTools = addToolBar(tr("File Operations"));
      fileTools->setObjectName("FileOperations");

      actionNew->setIcon(*icons[fileNew_ICON]);
      actionNew->setShortcut(QKeySequence(QKeySequence::New));
      fileTools->addAction(actionNew);

      actionOpen->setIcon(*icons[fileOpen_ICON]);
      actionOpen->setShortcut(QKeySequence(QKeySequence::Open));
      fileTools->addAction(actionOpen);

      actionSave->setIcon(*icons[fileSave_ICON]);
      actionSave->setShortcut(QKeySequence(QKeySequence::Save));
      fileTools->addAction(actionSave);

      actionQuit->setShortcut(QKeySequence(QKeySequence::Quit));

      actionManual->setIcon(QIcon(":/data/help.png"));
      actionManual->setShortcut(QKeySequence(QKeySequence::HelpContents));
      fileTools->addAction(actionManual);

      QToolBar* editTools = addToolBar(tr("Edit Operations"));
      editTools->setObjectName("EditOperations");
      actionUndo->setIcon(*icons[undo_ICON]);
      actionUndo->setShortcut(QKeySequence(QKeySequence::Undo));
      editTools->addAction(actionUndo);
      actionRedo->setIcon(*icons[redo_ICON]);
      actionRedo->setShortcut(QKeySequence(QKeySequence::Redo));
      editTools->addAction(actionRedo);
      actionUndo->setEnabled(false);
      actionRedo->setEnabled(false);

      log->setReadOnly(true);
      log->setMaximumBlockCount(1000);

      readSettings();
      setState(S_EMPTY);

      connect(run,        SIGNAL(clicked()),     SLOT(runClicked()));
      connect(stop,       SIGNAL(clicked()),     SLOT(stopClicked()));
      connect(actionOpen, SIGNAL(triggered()),   SLOT(loadPlugin()));
      connect(actionSave, SIGNAL(triggered()),   SLOT(savePlugin()));
      connect(actionNew,  SIGNAL(triggered()),   SLOT(newPlugin()));
      connect(actionQuit, SIGNAL(triggered()),   SLOT(close()));
      connect(actionManual, SIGNAL(triggered()), SLOT(showManual()));
      connect(actionUndo, SIGNAL(triggered()),         textEdit,   SLOT(undo()));
      connect(actionRedo, SIGNAL(triggered()),         textEdit,   SLOT(redo()));
      connect(textEdit,   SIGNAL(undoAvailable(bool)), actionUndo, SLOT(setEnabled(bool)));
      connect(textEdit,   SIGNAL(redoAvailable(bool)), actionRedo, SLOT(setEnabled(bool)));
      connect(textEdit,   SIGNAL(textChanged()), SLOT(textChanged()));
      }
开发者ID:guifre2,项目名称:MuseScore,代码行数:63,代码来源:pluginCreator.cpp

示例8: QMainWindow

MainWindow::MainWindow( QWidget* parent )
	: QMainWindow( parent ), filename(), infoFile() {
	
	fileNewA = new QAction( QIcon(":/fileNew.png"), tr( "New" ), this );
	fileNewA->setShortcut( tr("Ctrl+N") );
	fileNewA->setStatusTip( tr("Create a New NeuralNetwork") );
	fileNewA->setCheckable( false );
	connect( fileNewA, SIGNAL( triggered() ),
			this, SLOT( fileNew() ) );
	
	fileLoadA = new QAction( QIcon(":/fileOpen.png"), tr( "Open" ), this );
	fileLoadA->setShortcut( tr("Ctrl+O") );
	fileLoadA->setStatusTip( tr("Load a NeuralNetwork from file") );
	fileLoadA->setCheckable( false );
	connect( fileLoadA, SIGNAL( triggered() ),
			this, SLOT( fileLoad() ) );
	
	fileCloseA = new QAction( QIcon(":/fileClose.png"), tr( "Close" ), this );
	fileCloseA->setShortcut( tr("Ctrl+W") );
	fileCloseA->setStatusTip( tr("Close NeuralNetwork") );
	fileCloseA->setCheckable( false );
	connect( fileCloseA, SIGNAL( triggered() ),
			this, SLOT( fileClose() ) );
	
	fileSaveA = new QAction( QIcon(":/fileSave.png"), tr( "Save" ), this );
	fileSaveA->setShortcut( tr("Ctrl+S") );
	fileSaveA->setStatusTip( tr("Save NeuralNetwork") );
	fileSaveA->setCheckable( false );
	connect( fileSaveA, SIGNAL( triggered() ),
			this, SLOT( fileSave() ) );
	
	fileSaveasA = new QAction( QIcon(":/fileSaveas.png"), tr( "Save as ..." ), this );
	fileSaveasA->setShortcut( tr("Ctrl+S") );
	fileSaveasA->setStatusTip( tr("Save NeuralNetwork with differente name") );
	fileSaveasA->setCheckable( false );
	connect( fileSaveasA, SIGNAL( triggered() ),
			this, SLOT( fileSaveas() ) );
	
	addClusterA = new QAction( QIcon(":/addCluster.png"), tr( "Add a new Cluster" ), this );
	addClusterA->setShortcut( tr("Alt+C") );
	addClusterA->setStatusTip( tr("Create a new Cluster") );
	addClusterA->setCheckable( false );
	connect( addClusterA, SIGNAL( triggered() ),
			this, SLOT( addCluster() ) );

	addLinkerA = new QAction( QIcon(":/addLinker.png"), tr( "Add a new Linker" ), this );
	addLinkerA->setShortcut( tr("Alt+L") );
	addLinkerA->setStatusTip( tr("Create a new Linker") );
	addLinkerA->setCheckable( false );
	connect( addLinkerA, SIGNAL( triggered() ),
			this, SLOT( addLinker() ) );

	QAction* showCreditsA = new QAction( tr( "Credits" ), this );
	connect( showCreditsA, SIGNAL( triggered() ),
			this, SLOT( credits() ) );

	// ------- TOOLBAR
	QToolBar* fileT = addToolBar( tr("File") );
	fileT->setObjectName( "File-ToolBar" );
	fileT->addAction( fileNewA );
	fileT->addAction( fileLoadA );
	fileT->addAction( fileCloseA );
	fileT->addAction( fileSaveA );
	fileT->addAction( fileSaveasA );
	fileT->setMovable( false );

	fileT = addToolBar( tr("Edit") );
	fileT->setObjectName( "Edit-ToolBar" );
	fileT->addAction( addClusterA );
	fileT->addAction( addLinkerA );
	fileT->setMovable( false );

	// ------- MENU
	QMenuBar* bar = menuBar();
	QMenu* menu = bar->addMenu( tr("File") );
	menu->addAction( fileNewA );
	menu->addAction( fileLoadA );
	menu->addAction( fileCloseA );
	menu->addAction( fileSaveA );
	menu->addAction( fileSaveasA );
	
	menu = bar->addMenu( tr("Edit") );
	menu->addAction( addClusterA );
	menu->addAction( addLinkerA );
	
	QMenu* mviews = bar->addMenu( tr("Views") );

    menu = bar->addMenu( tr("&About") );
    menu->addAction( showCreditsA );

	statusBar()->setStyleSheet( "::item { border: 0px }" );
	statusBar()->showMessage( tr("Ready") );

	centre = new NeuralNetView( this );
	nn = 0;
	centre->setNeuralNet( 0 );
	setCentralWidget( centre );

	createBrowser();
	createPlotter();
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:nnfw-svn,代码行数:101,代码来源:mainWindow.cpp

示例9: QMainWindow

PianorollEditor::PianorollEditor(QWidget* parent)
   : QMainWindow(parent)
      {
      setWindowTitle(QString("MuseScore"));

      _score = 0;
      staff  = 0;

      QWidget* mainWidget = new QWidget;
      QGridLayout* layout = new QGridLayout;
      mainWidget->setLayout(layout);
      layout->setSpacing(0);

      QToolBar* tb = addToolBar(tr("toolbar1"));
      tb->addAction(getAction("undo"));
      tb->addAction(getAction("redo"));
      tb->addSeparator();
      tb->addAction(getAction("sound-on"));
#ifdef HAS_MIDI
      tb->addAction(getAction("midi-on"));
#endif
      QAction* a = getAction("follow");
      a->setCheckable(true);
      a->setChecked(preferences.followSong);

      tb->addAction(a);

      tb->addSeparator();
      tb->addAction(getAction("rewind"));
      tb->addAction(getAction("play"));
      tb->addSeparator();

      //-------------
      tb = addToolBar(tr("toolbar2"));
      layout->addWidget(tb, 1, 0, 1, 2);
      VoiceSelector* vs = new VoiceSelector;
      tb->addWidget(vs);

      tb->addSeparator();
      tb->addWidget(new QLabel(tr("Cursor:")));
      pos = new Awl::PosLabel;
      tb->addWidget(pos);
      Awl::PitchLabel* pl = new Awl::PitchLabel();
      tb->addWidget(pl);

      tb->addSeparator();
      tb->addWidget(new QLabel(tr("Velocity:")));
      veloType = new QComboBox;
      veloType->addItem(tr("offset"), OFFSET_VAL);
      veloType->addItem(tr("user"),   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);

      double xmag = .1;
      gv  = new PianoView;
      gv->scale(xmag, 1.0);
      layout->addWidget(gv, 3, 1);

      ruler = new Ruler;
      ruler->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
      ruler->setFixedHeight(rulerHeight);
      ruler->setMag(xmag, 1.0);

      layout->addWidget(ruler, 2, 1);

      Piano* piano = new Piano;
      piano->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
      piano->setFixedWidth(pianoWidth);
      layout->addWidget(piano, 3, 0);

      setCentralWidget(mainWidget);

      connect(gv->verticalScrollBar(), SIGNAL(valueChanged(int)), piano, SLOT(setYpos(int)));
      connect(gv->horizontalScrollBar(), SIGNAL(valueChanged(int)), ruler, SLOT(setXpos(int)));
      connect(gv,          SIGNAL(xposChanged(int)),           ruler,       SLOT(setXpos(int)));
      connect(gv,          SIGNAL(magChanged(double,double)),  ruler,       SLOT(setMag(double,double)));
      connect(gv,          SIGNAL(magChanged(double,double)),  piano,       SLOT(setMag(double,double)));
      connect(gv,          SIGNAL(pitchChanged(int)),          pl,          SLOT(setPitch(int)));
      connect(gv,          SIGNAL(pitchChanged(int)),          piano,       SLOT(setPitch(int)));
      connect(piano,       SIGNAL(pitchChanged(int)),          pl,          SLOT(setPitch(int)));
      connect(gv,          SIGNAL(posChanged(const Pos&)), pos,         SLOT(setValue(const Pos&)));
      connect(gv,          SIGNAL(posChanged(const Pos&)), ruler,       SLOT(setPos(const Pos&)));
      connect(ruler,       SIGNAL(posChanged(const Pos&)), pos,         SLOT(setValue(const Pos&)));
      connect(ruler,       SIGNAL(locatorMoved(int)),                       SLOT(moveLocator(int)));
      connect(veloType,    SIGNAL(activated(int)),                          SLOT(veloTypeChanged(int)));
      connect(velocity,    SIGNAL(valueChanged(int)),                       SLOT(velocityChanged(int)));
      connect(gv->scene(), SIGNAL(selectionChanged()),                      SLOT(selectionChanged()));
      connect(piano,       SIGNAL(keyPressed(int)),                         SLOT(keyPressed(int)));
      connect(piano,       SIGNAL(keyReleased(int)),                        SLOT(keyReleased(int)));
      resize(800, 400);
//.........这里部分代码省略.........
开发者ID:Mistobaan,项目名称:MuseScore,代码行数:101,代码来源:pianoroll.cpp

示例10: entryPoint

/**
\param bcont
**/
int entryPoint ( BfBulmaFact *bcont )
{
    BL_FUNC_DEBUG

    g_selcanales = new BcCanalSeleccionarView ( bcont->company(), 0 );
    g_selccostes = new BcCentroCosteSeleccionarView (bcont->company(), 0);
    
    /// Inicializa el sistema de traducciones 'gettext'.
    setlocale ( LC_ALL, "" );
    blBindTextDomain ( "pluginbf_canalyccoste", g_confpr->value( CONF_DIR_TRADUCCION ).toLatin1().constData() );
    g_pluginbf_canalyccoste = bcont;

    QMenu *pPluginMenu = bcont->menuMaestro;
    pPluginMenu->addSeparator();
    
    BlAction *accionA = new BlAction ( _ ( "&Canal" ), 0 );
    accionA->setStatusTip ( _ ( "Ver Canales" ) );
    accionA->setWhatsThis ( _ ( "Ver Canales" ) );
    accionA->setIcon ( QIcon ( QString::fromUtf8 ( ":/BulmaCont32x32/images/png/i_canales.xpm" ) ) );
    accionA->setObjectName("mui_actionCanal");
    pPluginMenu->addAction ( accionA );
    
    BlAction *accionB = new BlAction ( _ ( "&Centros de Coste" ), 0 );
    accionB->setStatusTip ( _ ( "Ver Centros de Coste" ) );
    accionB->setWhatsThis ( _ ( "Ver Centros de Coste" ) );
    accionB->setIcon ( QIcon ( QString::fromUtf8 ( ":/BulmaCont32x32/images/png/i_centroCoste.xpm" ) ) );
    accionB->setObjectName("mui_actionCCoste");
    pPluginMenu->addAction ( accionB );

    
    /// A&ntilde;adimos la nueva opci&oacute;n al men&uacute; principal del programa.
    /// Usamos un toolBox especial para meter los botones de contabilidad.
    QToolBar *toolCont =  bcont->findChild<QToolBar *> ( "contabilidad" );
    if ( !toolCont) {
	toolCont = new QToolBar(bcont);
	toolCont->setObjectName("contabilidad");
	toolCont->setFocusPolicy(Qt::TabFocus);
	toolCont->setOrientation(Qt::Horizontal);
	toolCont->setIconSize(QSize(32, 32));
        toolCont->setWindowTitle(N_("Contabilidad", 0));
        toolCont->setToolTip(N_("Contabilidad", 0));
        toolCont->setStatusTip(N_("Contabilidad", 0));
        toolCont->setWhatsThis(N_("Contabilidad", 0));
        toolCont->setAccessibleName(N_("Contabilidad", 0));
        toolCont->setAccessibleDescription(N_("Contabilidad", 0));
	bcont->addToolBar(Qt::TopToolBarArea, toolCont);
    } // end if
    toolCont->addAction(accionA);
    toolCont->addAction(accionB);
    
// =================================================
    /// Vamos a probar con un docwindow.
    BlDockWidget *doc1 = new BlDockWidget ( _ ( "Selector de Canales" ), bcont );
    doc1->setObjectName("mui_selcanales");
    doc1->setFeatures ( QDockWidget::AllDockWidgetFeatures );

    doc1->setGeometry ( 100, 100, 100, 500 );
    doc1->resize ( 330, 250 );
    bcont->addDockWidget ( Qt::RightDockWidgetArea, doc1 );

    doc1->show();

    doc1->setWidget ( g_selcanales );

// =================================================	
	
    
/**
 *
 *
 *
 *
 */	
// =================================================
    /// Vamos a probar con un docwindow.
    BlDockWidget *doc2 = new BlDockWidget ( _ ( "Selector de Centros de Coste" ), bcont );
    doc2->setObjectName("mui_selcostes");
    doc2->setFeatures ( QDockWidget::AllDockWidgetFeatures );

    doc2->setGeometry ( 100, 100, 100, 500 );
    doc2->resize ( 330, 250 );
    bcont->addDockWidget ( Qt::RightDockWidgetArea, doc2 );

    doc2->show();

    doc2->setWidget ( g_selccostes );

    return 0;
}
开发者ID:i02sopop,项目名称:Bulmages,代码行数:92,代码来源:pluginbf_canalyccoste.cpp

示例11: addToolBar

void BitcoinGUI::createToolBars()
{

    QToolBar *toolbar = addToolBar(tr("Tabs toolbar"));
	toolbar->setObjectName("toolbar");
    toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
	addToolBar(Qt::LeftToolBarArea,toolbar);
    toolbar->setOrientation(Qt::Vertical);
    toolbar->setMovable(false);

    QWidget* header = new QWidget();
    header->setMinimumSize(140, 45);
    header->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    header->setStyleSheet("QWidget { background-color: rgb(0,0,0); background-repeat: no-repeat; background-image: url(:/images/header); background-position: top center; }");
    toolbar->addWidget(header);

    toolbar->addAction(overviewAction);
    toolbar->addAction(sendCoinsAction);
    toolbar->addAction(receiveCoinsAction);
    toolbar->addAction(historyAction);
    toolbar->addAction(addressBookAction);
	toolbar->addAction(bittrexPageAction);
	toolbar->addAction(shockBotAction);
    toolbar->addAction(blockAction);
    toolbar->addAction(socialPageAction);
	toolbar->addAction(chatAction);
    toolbar->addAction(exportAction);
}
开发者ID:M1xProject,项目名称:M1Project,代码行数:28,代码来源:bitcoingui.cpp

示例12: m_default

InputStrList::InputStrList( QGridLayout *layout,int &row,
                            const QString & id, 
                            const QStringList &sl, ListMode lm,
                            const QString & docs)
  : m_default(sl), m_strList(sl), m_docs(docs), m_id(id)
{
  m_lab = new HelpLabel( id );

  m_le  = new QLineEdit;
  m_le->clear();

  QToolBar *toolBar = new QToolBar;
  toolBar->setIconSize(QSize(24,24));
  m_add = toolBar->addAction(QIcon(QString::fromAscii(":/images/add.png")),QString(),
                             this,SLOT(addString()));
  m_add->setToolTip(tr("Add item"));
  m_del = toolBar->addAction(QIcon(QString::fromAscii(":/images/del.png")),QString(),
                             this,SLOT(delString()));
  m_del->setToolTip(tr("Delete selected item"));
  m_upd = toolBar->addAction(QIcon(QString::fromAscii(":/images/refresh.png")),QString(),
                             this,SLOT(updateString()));
  m_upd->setToolTip(tr("Update selected item"));

  m_lb  = new QListWidget;
  //m_lb->setMinimumSize(400,100);
  foreach (QString s, m_strList) m_lb->addItem(s);
  
  m_brFile=0;
  m_brDir=0;
  if (lm!=ListString)
  {
    if (lm&ListFile)
    {
      m_brFile = toolBar->addAction(QIcon(QString::fromAscii(":/images/file.png")),QString(),
                                    this,SLOT(browseFiles()));
      m_brFile->setToolTip(tr("Browse to a file"));
    } 
    if (lm&ListDir)
    {
      m_brDir = toolBar->addAction(QIcon(QString::fromAscii(":/images/folder.png")),QString(),
                                   this,SLOT(browseDir()));
      m_brDir->setToolTip(tr("Browse to a folder"));
    }
  }
  QHBoxLayout *rowLayout = new QHBoxLayout;
  rowLayout->addWidget( m_le );
  rowLayout->addWidget( toolBar );
  layout->addWidget( m_lab,      row,0 );
  layout->addLayout( rowLayout,  row,1,1,2 );
  layout->addWidget( m_lb,       row+1,1,1,2 );
  row+=2;

  m_value = m_strList;

  connect(m_le,   SIGNAL(returnPressed()), 
          this, SLOT(addString()) );
  connect(m_lb,   SIGNAL(currentTextChanged(const QString &)), 
          this, SLOT(selectText(const QString &)));
  connect( m_lab, SIGNAL(enter()), SLOT(help()) );
  connect( m_lab, SIGNAL(reset()), SLOT(reset()) );
}
开发者ID:Ductapemaster,项目名称:doxverilog,代码行数:61,代码来源:inputstrlist.cpp

示例13: QLabel

void BitcreditGUI::createToolBars()
{
	QLabel *mylabel = new QLabel(this);
	mylabel->setPixmap(QPixmap(":images/head"));
	mylabel->show();
    QToolBar *toolbar = addToolBar(tr("Menu"));
    toolbar->setObjectName("toolbar");
    addToolBar(Qt::LeftToolBarArea, toolbar);
    toolbar->addWidget(mylabel);
    toolbar->setOrientation(Qt::Vertical);
    toolbar->setMovable(false);
    toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
	toolbar->setIconSize(QSize(50,20));
	
	
    if(walletFrame)
    {
		
		toolbar->addAction(overviewAction);
        toolbar->addAction(sendCoinsAction);
        toolbar->addAction(receiveCoinsAction);
        toolbar->addAction(historyAction);
		toolbar->addAction(exchangeAction);
		toolbar->addAction(blockAction);
		toolbar->addAction(bankstatsAction);		        
	    toolbar->addAction(sendMessagesAction);
	    toolbar->addAction(messageAction);
	    toolbar->addAction(invoiceAction);
	    toolbar->addAction(receiptAction);		
		toolbar->addAction(voteCoinsAction);
		toolbar->addAction(chatAction);
		
        overviewAction->setChecked(true);
    }
    
    //QWidget* spacer = new QWidget();
   // spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
   // toolbar->addWidget(spacer);
    toolbar->addAction(optionsAction);
    //spacer->setObjectName("spacer");
    toolbar->setStyleSheet("#toolbar { font-weight:600;border:none;height:100%;padding-top:20px; background: rgb(0, 0, 0); text-align: left; color: white;min-width:180px;max-width:180px;} QToolBar QToolButton:hover {background:rgb(28, 29, 33);} QToolBar QToolButton:checked {background:rgba(28, 29, 33, 100);}  QToolBar QToolButton { font-weight:600;font-size:10px;font-family:'Century Gothic';padding-left:20px;padding-right:181px;padding-top:4px;padding-bottom:4px; width:100%; color: white; text-align: left; background:transparent;text-transform:uppercase; }");
        	
}
开发者ID:JoshuaAmsden,项目名称:bicreditsnew,代码行数:43,代码来源:bitcreditgui.cpp

示例14: QMainWindow


//.........这里部分代码省略.........
    tabs = new QTabWidget(this);
    tabs->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    tabs->setContentsMargins(0,0,0,0);
    tabs->setMaximumSize(9000, 9000);
    tabs->setTabPosition(QTabWidget::South);
    tabs->setMovable(false); // just to be sure

    tabs->addTab(editorPanel,   QIcon(c_icon_editor),   tr("Editor"));
    tabs->addTab(voicesPanel,   QIcon(c_icon_voices),   tr("Voices"));
    tabs->addTab(pluginsPanel,  QIcon(c_icon_plugins),  tr("Plugins"));
    tabs->addTab(settingsPanel, QIcon(c_icon_settings), tr("Settings"));
    tabs->addTab(docsPanel,     QIcon(c_icon_doc),      tr("Documentation"));
    tabs->addTab(logPanel,      QIcon(c_icon_log),      tr("Log"));

    tabs->widget(0)->setContentsMargins(0,0,0,0);
    tabs->widget(1)->setContentsMargins(0,0,0,0);
    tabs->widget(2)->setContentsMargins(0,0,0,0);
    tabs->widget(3)->setContentsMargins(0,0,0,0);
    tabs->widget(4)->setContentsMargins(0,0,0,0);
    tabs->widget(5)->setContentsMargins(0,0,0,0);

    logTabTextColor = tabs->tabBar()->tabTextColor(5);

    connect(tabs, SIGNAL(currentChanged(int)), SLOT(onTabSelected(int)));

    QVBoxLayout *vbl = new QVBoxLayout();
    vbl->setContentsMargins(0,0,0,0);
    vbl->addWidget(tabs);
    ui->centralWidget->setContentsMargins(0,0,0,0);
    ui->centralWidget->setLayout(vbl);

    //---- Toolbars --------------------------------

    QToolBar *fileTB   = new QToolBar("Fileops",  this);
    QToolBar *playerTB = new QToolBar("Playback", this);
    QToolBar *toolsTB  = new QToolBar("Toolset",  this);

    fileTB  ->setFloatable(false);
    playerTB->setFloatable(false);
    toolsTB ->setFloatable(false);

    fileTB->addAction(ui->actionSave);
    fileTB->addAction(ui->actionSave_audio_as);
    fileTB->addAction(ui->actionUndo);
    fileTB->addAction(ui->actionRedo);

    playerTB->addAction(ui->actionPlay);
    playerTB->addAction(ui->actionStop);
    playerTB->addAction(ui->actionBack);
    playerTB->addAction(ui->actionRepeat);

    volume = new QSlider(Qt::Horizontal, this);
    volume->setMaximum(100);
    volume->setSingleStep(1);
    volume->setPageStep(1);
    volume->setValue(settings.value(c_key_sound, 50).toInt());
    volume->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
    connect(playerTB, SIGNAL(orientationChanged(Qt::Orientation)), volume, SLOT(setOrientation(Qt::Orientation)));

    muteBtn = new QAction(QIcon(c_icon_sound), "", this);
    muteBtn->setCheckable(true);
    connect(muteBtn, SIGNAL(toggled(bool)), SLOT(onMute(bool)));

    playerTB->addWidget(volume);
    playerTB->addAction(muteBtn);
开发者ID:kbinani,项目名称:editor,代码行数:66,代码来源:mainwindow.cpp

示例15: QSplitter

SalesOrderManager::SalesOrderManager(QWidget* parent)
    : QSplitter(parent)
{
    model = new SalesOrderModel(this);
    proxyModel = new SalesOrderProxyModel(this);
    proxyModel->setSourceModel(model);

    QWidget* container = new QWidget(this);
    QBoxLayout* containerLayout = new QVBoxLayout(container);
    containerLayout->setMargin(0);

    QString actionTooltip("%1<br><b>%2</b>");
    QToolBar* toolBar = new QToolBar(container);
    toolBar->setIconSize(QSize(16, 16));
    QAction* refreshAction = toolBar->addAction(QIcon(":/resources/icons/refresh.png"), "&Muat Ulang", this, SLOT(refresh()));
    refreshAction->setShortcut(QKeySequence("F5"));
    refreshAction->setToolTip(actionTooltip.arg("Muat ulang daftar pesanan").arg(refreshAction->shortcut().toString()));

    QAction* newAction = toolBar->addAction(QIcon(":/resources/icons/plus.png"), "&Baru", this, SLOT(openEditor()));
    newAction->setShortcut(QKeySequence("Ctrl+N"));
    newAction->setToolTip(actionTooltip.arg("Pesanan baru").arg(newAction->shortcut().toString()));

    QAction* closeTabAction = new QAction(this);
    closeTabAction->setShortcuts(QList<QKeySequence>({QKeySequence("Esc"), QKeySequence("Ctrl+W")}));
    addAction(closeTabAction);

    QAction* closeAllTabsAction = new QAction(this);
    closeAllTabsAction->setShortcut(QKeySequence("Ctrl+Shift+W"));
    addAction(closeAllTabsAction);

    containerLayout->addWidget(toolBar);

    QLabel* spacer = new QLabel(toolBar);
    spacer->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
    toolBar->addWidget(spacer);

    stateComboBox = new QComboBox(toolBar);
    stateComboBox->setToolTip("Saring daftar pesanan berdasarkan status");
    stateComboBox->addItem("Semua");
    stateComboBox->addItem("Aktif");
    stateComboBox->addItem("Selesai");
    stateComboBox->addItem("Dibatalkan");
    stateComboBox->setCurrentIndex(1);
    toolBar->addWidget(stateComboBox);

    searchEdit = new QLineEdit(toolBar);
    searchEdit->setToolTip("Cari di daftar pesanan");
    searchEdit->setPlaceholderText("Cari");
    searchEdit->setClearButtonEnabled(true);
    searchEdit->setMaxLength(100);
    searchEdit->setMaximumWidth(150);
    toolBar->addWidget(searchEdit);

    view = new QTableView(container);
    view->setToolTip("Klik ganda atau ketuk Enter untuk membuka pesanan");
    view->setModel(proxyModel);
    view->setAlternatingRowColors(true);
    view->setSortingEnabled(true);
    view->setSelectionMode(QAbstractItemView::SingleSelection);
    view->setSelectionBehavior(QAbstractItemView::SelectRows);
    view->setTabKeyNavigation(false);
    QHeaderView* header = view->verticalHeader();
    header->setVisible(false);
    header->setMinimumSectionSize(20);
    header->setMaximumSectionSize(20);
    header->setDefaultSectionSize(20);
    header = view->horizontalHeader();
    header->setToolTip("Klik pada header kolom untuk mengurutkan");
    header->setHighlightSections(false);

    containerLayout->addWidget(view);

    infoLabel = new QLabel(container);
    infoLabel->setStyleSheet("font-style:italic;padding-bottom:1px;");
    infoLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
    containerLayout->addWidget(infoLabel);

    tabWidget = new QTabWidget(this);
    tabWidget->setDocumentMode(true);
    tabWidget->setTabsClosable(true);
    tabWidget->setMovable(true);
    tabWidget->hide();

    setCollapsible(0, false);
    setCollapsible(1, false);

    connect(closeTabAction, SIGNAL(triggered(bool)), SLOT(closeCurrentTab()));
    connect(closeAllTabsAction, SIGNAL(triggered(bool)), SLOT(closeAllTabs()));
    connect(tabWidget, SIGNAL(tabCloseRequested(int)), SLOT(closeTab(int)));
    connect(stateComboBox, SIGNAL(currentIndexChanged(int)), SLOT(refresh()));
    connect(searchEdit, SIGNAL(textChanged(QString)), SLOT(applyFilter()));
    connect(view, SIGNAL(activated(QModelIndex)), SLOT(edit()));

    QTimer::singleShot(0, this, SLOT(init()));
}
开发者ID:ffrz,项目名称:bilzia-pos,代码行数:95,代码来源:salesordermanager.cpp


注:本文中的QToolBar类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。