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


C++ QToolBar::addAction方法代码示例

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


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

示例1: setupFileActions

void TextEdit::setupFileActions()
{
  QToolBar *tb = new QToolBar(this);
  tb->setWindowTitle(tr("File Actions"));
  addToolBar(tb);

//  QMenu *menu = new QMenu(tr("&File"), this);
//  menuBar()->addMenu(menu);

  QAction *a;

  QIcon newIcon = QIcon::fromTheme("document-new", QIcon(rsrcPath + "/filenew.png"));
  a = new QAction( newIcon, tr("&New"), this);
  a->setPriority(QAction::LowPriority);
  a->setShortcut(QKeySequence::New);
  connect(a, SIGNAL(triggered()), this, SLOT(fileNew()));
  tb->addAction(a);
//  menu->addAction(a);

  a = new QAction(QIcon::fromTheme("document-open", QIcon(rsrcPath + "/fileopen.png")),
                  tr("&Open..."), this);
  a->setShortcut(QKeySequence::Open);
  connect(a, SIGNAL(triggered()), this, SLOT(fileOpen()));
  tb->addAction(a);
//  menu->addAction(a);

//  menu->addSeparator();

  actionSave = a = new QAction(QIcon::fromTheme("document-save", QIcon(rsrcPath + "/filesave.png")),
                               tr("&Save"), this);
  a->setShortcut(QKeySequence::Save);
  connect(a, SIGNAL(triggered()), this, SLOT(fileSave()));
  a->setEnabled(false);
  tb->addAction(a);
//  menu->addAction(a);

  a = new QAction(tr("Save &As..."), this);
  a->setPriority(QAction::LowPriority);
  connect(a, SIGNAL(triggered()), this, SLOT(fileSaveAs()));
//  menu->addAction(a);
//  menu->addSeparator();

#ifndef QT_NO_PRINTER
  a = new QAction(QIcon::fromTheme("document-print", QIcon(rsrcPath + "/fileprint.png")),
                  tr("&Print..."), this);
  a->setPriority(QAction::LowPriority);
  a->setShortcut(QKeySequence::Print);
  connect(a, SIGNAL(triggered()), this, SLOT(filePrint()));
  tb->addAction(a);
//  menu->addAction(a);

  a = new QAction(QIcon::fromTheme("fileprint", QIcon(rsrcPath + "/fileprint.png")),
                  tr("Print Preview..."), this);
  connect(a, SIGNAL(triggered()), this, SLOT(filePrintPreview()));
//  menu->addAction(a);

  a = new QAction(QIcon::fromTheme("exportpdf", QIcon(rsrcPath + "/exportpdf.png")),
                  tr("&Export PDF..."), this);
  a->setPriority(QAction::LowPriority);
  a->setShortcut(Qt::CTRL + Qt::Key_D);
  connect(a, SIGNAL(triggered()), this, SLOT(filePrintPdf()));
  tb->addAction(a);
//  menu->addAction(a);

//  menu->addSeparator();
#endif

  a = new QAction(tr("&Quit"), this);
  a->setShortcut(Qt::CTRL + Qt::Key_Q);
  connect(a, SIGNAL(triggered()), this, SLOT(close()));
//  menu->addAction(a);
}
开发者ID:counterstriker,项目名称:qtapplications,代码行数:72,代码来源:textedit.cpp

示例2: QDialog

Dialog_Mail::Dialog_Mail(QWidget *parent, QString iTitle, int *iIdx, DialogMailType iMode)
    : QDialog(parent)
{
    Mode = iMode;
    Idx = iIdx;
    setWindowTitle(iTitle);

    QAction *ActSend = new QAction(tr("Отправить"),this);
    ActSend->setIcon(QPixmap(":img/SendMail.png"));
    ActSend->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S));
    ActSend->setText(tr("&Отправить Сообщения"));
    ActSend->setToolTip(tr("Отправить Сообщения"));
    ActSend->setStatusTip(tr("Отправить Сообщения"));
    connect(ActSend, SIGNAL(triggered()), this, SLOT(SlotSend()));

    QAction *ActSave = new QAction(tr("Сохранить"),this);
    ActSave->setIcon(QPixmap(":img/Save.png"));
    ActSave->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_R));
    ActSave->setText(tr("&Сохранить Сообщение"));
    ActSave->setToolTip(tr("Сохранить Сообщение"));
    ActSave->setStatusTip(tr("Сохранить Сообщение"));
    connect(ActSave, SIGNAL(triggered()), this, SLOT(SlotSave()));

    QAction *ActCancel = new QAction(tr("Отменить"),this);
    ActCancel->setIcon(QPixmap(":img/Cancel.png"));
    ActCancel->setShortcut(QKeySequence("ESC"));
    ActCancel->setText(tr("&Отменить Сообщение"));
    ActCancel->setToolTip(tr("Отменить Сообщение"));
    ActCancel->setStatusTip(tr("Отменить Сообщение"));
    connect(ActCancel, SIGNAL(triggered()), this, SLOT(SlotCancel()));

    QHBoxLayout *ToolLayout = new QHBoxLayout();
    ToolLayout->setMargin(0);
    QToolBar *ToolBar = new QToolBar();
    ToolBar->setOrientation(Qt::Horizontal);
    ToolBar->setToolButtonStyle(Qt::ToolButtonIconOnly);
    ToolLayout->addWidget(ToolBar);

    ToolBar->addAction(ActSend);
    ToolBar->addSeparator();
    ToolBar->addAction(ActSave);
    ToolBar->addSeparator();
    ToolBar->addAction(ActCancel);

    QFrame *ToolFrame = new QFrame();
    ToolFrame->setStyleSheet(QString("background-color: %1").arg(Global.Palette.color(QPalette::Window).name()));
    ToolFrame->setFrameStyle(QFrame::StyledPanel | QFrame::Plain);
    ToolFrame->setLayout(ToolLayout);

    QVBoxLayout *TBox = new QVBoxLayout();
    TBox->setMargin(0);
    Receiver = new QComboBox();
    Subj = new QLineEdit();
    Message = new QTextEdit();
    QFormLayout *Form = new QFormLayout();
    Form->addRow(tr("Получатель: "), Receiver);
    Form->addRow(tr("Тема: "), Subj);
    Form->setLabelAlignment(Qt::AlignRight);
    TBox->addLayout(Form,0);
    TBox->addWidget(Message,1);

    QFrame *Center = new QFrame();
    Center->setLayout(TBox);

    QVBoxLayout *Out = new QVBoxLayout();
    Out->addWidget(ToolFrame,0);
    Out->addSpacing(4);
    Out->addWidget(Center,1);
    setLayout(Out);
    setMinimumSize(480,320);
    Init();
}
开发者ID:Majestio,项目名称:RegClient,代码行数:72,代码来源:Dialog_Mail.cpp

示例3: 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();
	}
开发者ID:PierFio,项目名称:ball,代码行数:70,代码来源:mainframe.C

示例4: 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);
}
开发者ID:netrunner-debian-kde-extras,项目名称:tora,代码行数:94,代码来源:tosgatrace.cpp

示例5: QMainWindow

RMainWnd::RMainWnd(reditor::REditor* edit) : QMainWindow(), medit(edit)
{
    setWindowTitle(tr("Room Editor"));
    setWindowIcon(QIcon(":/resources/favicon.ico"));
    
    // central widget
    meditWnd = new REditWnd(medit->objects(), medit->camera(), this);
    setCentralWidget(meditWnd);
    
    // set corners for docks
    setCorner(Qt::TopRightCorner, Qt::RightDockWidgetArea);
    setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);
    setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);
    setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
    
    // docks
    mloggerDock = new QDockWidget(this);
    mloggerDock->setWindowTitle(tr("Editor Log"));
    mlogger = new RLogger(mloggerDock);
    mloggerDock->setWidget(mlogger);
    addDockWidget(Qt::BottomDockWidgetArea, mloggerDock);
    // TODO attach dock window with objects on the scene
    
    // File menu
    QMenu* fileMenu = menuBar()->addMenu(tr("&File"));
    QAction* newAction = fileMenu->addAction(tr("&New Project"), this, SIGNAL(newProject()), QKeySequence::New);
    newAction->setIcon(QIcon(":/resources/new.png"));
    QAction* openAction = fileMenu->addAction(tr("&Open Project.."), this, SIGNAL(openProject()), QKeySequence::Open);
    openAction->setIcon(QIcon(":/resources/open.png"));
    fileMenu->addSeparator();
    msaveAction = fileMenu->addAction(tr("&Save Project"), this, SIGNAL(saveProject()), QKeySequence::Save);
    msaveAction->setIcon(QIcon(":/resources/save.png"));
    msaveAsAction = fileMenu->addAction(tr("S&ave Project As..."), this, SIGNAL(saveProjectAs()), Qt::SHIFT + Qt::CTRL + Qt::Key_S);
    msaveAsAction->setIcon(QIcon(":/resources/saveAs.png"));
    enableSave(false); // activate after user makes some changes, no sense to save empty project
    fileMenu->addSeparator();
    fileMenu->addAction(tr("&Exit.."), this, SLOT(close()), QKeySequence::Quit);
    
    // Help menu
    QMenu* helpMenu = menuBar()->addMenu(tr("&Help"));
    helpMenu->addAction(tr("&About RoomEdit"), this, SIGNAL(helpAbout()));
    
    // File toolbar
    QToolBar* fileToolBar = addToolBar(tr("File"));
    fileToolBar->addAction(newAction);
    fileToolBar->addAction(openAction);
    fileToolBar->addSeparator();
    fileToolBar->addAction(msaveAction);
    fileToolBar->addAction(msaveAsAction);
    
    // Camera view toolbar
    QToolBar* cameraToolBar = addToolBar(tr("Camera"));
    mcameraGroup = new QButtonGroup(cameraToolBar);
    QPushButton * cam1 = new QPushButton(QString("1"), this);
    QPushButton * cam2 = new QPushButton(QString("2"), this);
    QPushButton * cam3 = new QPushButton(QString("3"), this);
    cam1->setCheckable(true);
    cam2->setCheckable(true);
    cam3->setCheckable(true);
    cam1->setChecked(true);
    mcameraGroup->addButton(cam1, 1);
    mcameraGroup->addButton(cam2, 2);
    mcameraGroup->addButton(cam3, 3);
    mcameraGroup->setExclusive(true);
    connect(mcameraGroup, SIGNAL(buttonClicked(int)), this, SIGNAL(switchCamera(int)));
    cameraToolBar->addWidget(cam1);
    cameraToolBar->addWidget(cam2);
    cameraToolBar->addWidget(cam3);
}
开发者ID:ddaroo,项目名称:RoomEdit,代码行数:69,代码来源:RMainWnd.cpp

示例6: QMainWindow

Window::Window(QWidget* parent):
    QMainWindow(parent)
{
    setObjectName("PlanetScannerWindow");

    QToolBar* toolbar = new QToolBar(this);
    toolbar->setIconSize(QSize(24, 24));
    toolbar->setFloatable(false);
    toolbar->setContextMenuPolicy(Qt::PreventContextMenu);
    addToolBar(toolbar);

    QAction* refreshAction = toolbar->addAction(QIcon(":/icons/refresh.png"), "Refresh");
    connect(refreshAction, SIGNAL(triggered()), this, SLOT(refreshPlanets()));
    QAction* settingsAction = toolbar->addAction(QIcon(":/icons/settings.png"), "Settings");
    connect(settingsAction, SIGNAL(triggered()), this, SLOT(showSettingsDialog()));

    planetTreeView = new QTreeView(this);
    planetTreeView->setMinimumHeight(10);
    planetTreeModel = new PlanetTreeModel(planetTreeView);
    planetTreeProxyModel = new PlanetTreeSortFilterProxyModel(planetTreeModel);
    planetTreeProxyModel->setSourceModel(planetTreeModel);
    planetTreeView->setModel(planetTreeProxyModel);
    planetTreeModel->setHorizontalHeaderLabels(QStringList() << "Hostname" << "Map" << "Gametype" << "Players" << "Address");
    planetTreeView->setSortingEnabled(true);
    planetTreeView->sortByColumn(0, Qt::AscendingOrder);
    planetTreeView->setContextMenuPolicy(Qt::CustomContextMenu);
    planetTreeView->setSelectionMode(QAbstractItemView::SingleSelection);
    connect(planetTreeView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showContextMenu(QPoint)));

    QAction* connectAction = new QAction("Connect", planetTreeView);
    QAction* connectAsSpectatorAction = new QAction("Connect as spectator", planetTreeView);
    QAction* copyAction = new QAction("Copy", planetTreeView);
    QAction* openProfileAction = new QAction("Open profile in a browser", planetTreeView);
    connect(connectAction, SIGNAL(triggered()), this, SLOT(connectSelected()));
    connect(connectAsSpectatorAction, SIGNAL(triggered()), this, SLOT(connectAsSpectatorSelected()));
    connect(copyAction, SIGNAL(triggered()), this, SLOT(copySelected()));
    connect(openProfileAction, &QAction::triggered, this, &Window::openProfileSelected);
    gameContextMenu = new QMenu(planetTreeView);
    planetContextMenu = new QMenu(planetTreeView);
    registeredPlayerContextMenu = new QMenu(planetTreeView);
    unregisteredPlayerContextMenu = new QMenu(planetTreeView);
    gameContextMenu->addActions(QList<QAction*>() << connectAction << connectAsSpectatorAction << copyAction);
    planetContextMenu->addActions(QList<QAction*>() << copyAction);
    registeredPlayerContextMenu->addActions(QList<QAction*>() << openProfileAction << copyAction);
    unregisteredPlayerContextMenu->addActions(QList<QAction*>() << copyAction);

    setCentralWidget(planetTreeView);

    game = new QProcess(this);

    statistics = new StatisticsWebSite(this);
    connect(statistics, &StatisticsWebSite::playersInfoRecieved, this, &Window::processStatisticsPlayers);

    autoRefreshTimer = new QTimer(this);
    connect(autoRefreshTimer, SIGNAL(timeout()), this, SLOT(refreshPlanets()));

    contextMenuShown = false;

    Settings& settings = Settings::getInstance();
    connect(&settings, &Settings::dataChanged, this, &Window::applyChangedSettings);
    settings.load();
    applyChangedSettings();

    ::Settings::loadWindow(this);

    refreshPlanets();
}
开发者ID:nurupo,项目名称:nfk-lobby,代码行数:67,代码来源:planetscannerwindow.cpp

示例7: 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 );
}
开发者ID:ClementVidal,项目名称:sable.dune,代码行数:73,代码来源:ShaderEditor.cpp

示例8: QMainWindow

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    // Setup this MainWindow with the parameters mainwindow.ui:
    // Definition of size, creation of widgets inside etc..
    ui->setupUi(this);

    // Retrieve pointers of widgets already created by the up operation
    // Those who will be used again outside the creator are saved at class variables
    QMenuBar * menuBar = ui->menuBar;
    QSlider *slider_color = ui->verticalSlider;
    QSlider *slider_style = ui->verticalSlider_2;
    QToolBar * toolbar = ui->toolBar;
    mydrawzone = ui->widget;

    // Declaration of menus and adition inside menubar
    QMenu * openMenu = menuBar->addMenu( tr("&Open"));
    QMenu * saveMenu = menuBar->addMenu( tr("&Save"));
    QMenu * quitMenu = menuBar->addMenu( tr("&Quit"));
    QMenu * penMenu = menuBar->addMenu( tr("&Pen Settings"));
    QMenu * colorMenu = menuBar->addMenu( tr("&Color Settings"));
    QMenu * styleMenu = menuBar->addMenu( tr("&Style Settings"));
    QMenu * formMenu = menuBar->addMenu( tr("&Form Settings"));

    // Declaration of principal actions
    // Those that will be shown at the toolbar
    QAction * openAction = new QAction( QIcon(":/icons/open.png"), tr("&Open"), this);
    QAction * saveAction = new QAction( QIcon(":/icons/save.png"), tr("&Save"), this);
    QAction * quitAction = new QAction( QIcon(":/icons/quit.png"), tr("&Quit"), this);
    QAction * paintAction = new QAction( QIcon(":/icons/paint.png"), tr("&Paint"), this);
    QAction * editAction = new QAction( QIcon(":/icons/edit.png"), tr("&Edit"), this);
    QAction * moveAction = new QAction( QIcon(":/icons/move.png"), tr("&Edit"), this);

    // Declaration of some other actions
    // Those that will have shortcuts as well but wont be shown in the toolbar
    QAction *set_pen_color =new QAction(tr("Alternate Color Pen"), this);
    QAction *set_pen_width_larger =new QAction(tr("&Pen Width +"), this);
    QAction *set_pen_width_shorter =new QAction(tr("&Pen Width -"), this);
    QAction *set_pen_style =new QAction(tr("&Alternate Style Pen"), this);
    QAction *set_figure_form =new QAction(tr("&Alternate Figure Form"), this);
    QAction *undo =new QAction(tr("&Undo"), this);

    // Declaration of action groups
    // The pointers for the actions are saved inside class variables
    // to be used outside the class creator
    QActionGroup *action_group_color = new QActionGroup(this);
    color0 = action_group_color->addAction(tr("Black Pen"));
    color1 = action_group_color->addAction(tr("White Pen"));
    color2 = action_group_color->addAction(tr("Dark Gray Pen"));
    color3 = action_group_color->addAction(tr("Gray Pen"));
    color4 = action_group_color->addAction(tr("Light Gray Pen"));
    color5 = action_group_color->addAction(tr("Red Pen"));
    color6 = action_group_color->addAction(tr("Green Pen"));
    color7 = action_group_color->addAction(tr("Blue Pen"));
    color8 = action_group_color->addAction(tr("Cyan Pen"));
    color9 = action_group_color->addAction(tr("Magenta Pen"));
    color10 = action_group_color->addAction(tr("Yellow Pen"));
    color11 = action_group_color->addAction(tr("Dark Red Pen"));
    color12 = action_group_color->addAction(tr("Dark Green Pen"));
    color13 = action_group_color->addAction(tr("Dark Blue Pen"));
    color14 = action_group_color->addAction(tr("Dark Cyan Pen"));
    color15 = action_group_color->addAction(tr("Dark Magenta Pen"));
    color16 = action_group_color->addAction(tr("Dark Yellow Pen"));
    color17 = action_group_color->addAction(tr("Transparent"));

    QActionGroup *action_group_style = new QActionGroup(this);
    style0 = action_group_style->addAction(tr("Solid Pen"));
    style1 = action_group_style->addAction(tr("Dash Line Pen"));
    style2 = action_group_style->addAction(tr("Dot Line Pen"));
    style3 = action_group_style->addAction(tr("Dash dot Line Pen"));
    style4 = action_group_style->addAction(tr("Dash Dot Dot Line Pen"));
    style5 = action_group_style->addAction(tr("Custom Dash Line Pen"));

    QActionGroup *action_group_form = new QActionGroup(this);
    form0 = action_group_form->addAction(tr("Line Form"));
    form1 = action_group_form->addAction(tr("Rectangle Form"));
    form2 = action_group_form->addAction(tr("Elipse Form"));

    // Adition of shortcuts for principal actions
    openAction->setShortcut( tr("Ctrl+O"));
    saveAction->setShortcut( tr("Ctrl+S"));
    quitAction->setShortcut( tr("Ctrl+Q"));
    paintAction->setShortcut( tr("Ctrl+P"));
    editAction->setShortcut( tr("Ctrl+E"));
    moveAction->setShortcut( tr("Ctrl+M"));

    // Adition of shortcuts for those other actions
    set_pen_color->setShortcut( tr("Ctrl+C"));
    set_pen_style->setShortcut( tr("Ctrl+Space"));
    set_pen_width_larger->setShortcut( tr("Ctrl++"));
    set_pen_width_shorter->setShortcut( tr("Ctrl+-"));
    set_figure_form->setShortcut( tr("Ctrl+F"));
    undo->setShortcut(tr ("Ctrl+Z"));

    // Adition of tool tips for principal actions
    openAction->setToolTip( tr("Open file"));
    saveAction->setToolTip( tr("Save file"));
    quitAction->setToolTip( tr("Quit file"));

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

示例9: QMainWindow

WndSets::WndSets(QWidget *parent)
    : QMainWindow(parent)
{
    // left toolbar
    QToolBar *setsEditToolBar = new QToolBar;
    setsEditToolBar->setOrientation(Qt::Vertical);
    setsEditToolBar->setIconSize(QSize(24, 24));
    setsEditToolBar->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);

    aTop = new QAction(QString(), this);
    aTop->setIcon(QIcon("theme:icons/arrow_top_green.svg"));
    aTop->setToolTip(tr("Move selected set to the top"));
    aTop->setEnabled(false);
    connect(aTop, SIGNAL(triggered()), this, SLOT(actTop()));
    setsEditToolBar->addAction(aTop);

    aUp = new QAction(QString(), this);
    aUp->setIcon(QIcon("theme:icons/arrow_up_green.svg"));
    aUp->setToolTip(tr("Move selected set up"));
    aUp->setEnabled(false);
    connect(aUp, SIGNAL(triggered()), this, SLOT(actUp()));
    setsEditToolBar->addAction(aUp);

    aDown = new QAction(QString(), this);
    aDown->setIcon(QIcon("theme:icons/arrow_down_green.svg"));
    aDown->setToolTip(tr("Move selected set down"));
    aDown->setEnabled(false);
    connect(aDown, SIGNAL(triggered()), this, SLOT(actDown()));
    setsEditToolBar->addAction(aDown);

    aBottom = new QAction(QString(), this);
    aBottom->setIcon(QIcon("theme:icons/arrow_bottom_green.svg"));
    aBottom->setToolTip(tr("Move selected set to the bottom"));
    aBottom->setEnabled(false);
    connect(aBottom, SIGNAL(triggered()), this, SLOT(actBottom()));
    setsEditToolBar->addAction(aBottom);

    // view 
    model = new SetsModel(db, this);
    view = new QTreeView;
    view->setModel(model);

    view->setAlternatingRowColors(true);
    view->setUniformRowHeights(true);
    view->setAllColumnsShowFocus(true);
    view->setSortingEnabled(true);
    view->setSelectionMode(QAbstractItemView::SingleSelection);
    view->setSelectionBehavior(QAbstractItemView::SelectRows);

    view->setDragEnabled(true);
    view->setAcceptDrops(true);
    view->setDropIndicatorShown(true);
    view->setDragDropMode(QAbstractItemView::InternalMove);

#if QT_VERSION < 0x050000
    view->header()->setResizeMode(QHeaderView::Stretch);
    view->header()->setResizeMode(SetsModel::LongNameCol, QHeaderView::ResizeToContents);
#else
    view->header()->setSectionResizeMode(QHeaderView::Stretch);
    view->header()->setSectionResizeMode(SetsModel::LongNameCol, QHeaderView::ResizeToContents);
#endif

    view->sortByColumn(SetsModel::SortKeyCol, Qt::AscendingOrder);
    view->setColumnHidden(SetsModel::SortKeyCol, true);
    view->setColumnHidden(SetsModel::IsKnownCol, true);
    view->setRootIsDecorated(false);

    connect(view->selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
        this, SLOT(actToggleButtons(const QItemSelection &, const QItemSelection &)));

    // bottom buttons
    enableAllButton = new QPushButton(tr("Enable all sets"));
    connect(enableAllButton, SIGNAL(clicked()), this, SLOT(actEnableAll()));
    disableAllButton = new QPushButton(tr("Disable all sets"));
    connect(disableAllButton, SIGNAL(clicked()), this, SLOT(actDisableAll()));


    QLabel *labNotes = new QLabel;
    labNotes->setText("<b>" + tr("hints:") + "</b>" + "<ul><li>" + tr("Enable the sets that you want to have available in the deck editor") + "</li><li>" + tr("Move sets around to change their order, or click on a column header to sort sets on that field") + "</li><li>" + tr("Sets order decides the source that will be used when loading images for a specific card") + "</li><li>" + tr("Disabled sets will be used for loading images only if all the enabled sets failed") + "</li></ul>");

    QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
    connect(buttonBox, SIGNAL(accepted()), this, SLOT(actSave()));
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(actRestore()));

    QGridLayout *mainLayout = new QGridLayout;
    mainLayout->addWidget(setsEditToolBar, 0, 0, 1, 1);
    mainLayout->addWidget(view, 0, 1, 1, 2);
    mainLayout->addWidget(enableAllButton, 1, 1, 1, 1);
    mainLayout->addWidget(disableAllButton, 1, 2, 1, 1);
    mainLayout->addWidget(labNotes, 2, 1, 1, 2);
    mainLayout->addWidget(buttonBox, 3, 1, 1, 2);
    mainLayout->setColumnStretch(1, 1);
    mainLayout->setColumnStretch(2, 1);

    QWidget *centralWidget = new QWidget;
    centralWidget->setLayout(mainLayout);
    setCentralWidget(centralWidget);

    setWindowTitle(tr("Edit sets"));
    resize(700, 400);
//.........这里部分代码省略.........
开发者ID:sugitime,项目名称:Cockatrice,代码行数:101,代码来源:window_sets.cpp

示例10: 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);

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

示例11: QSignalMapper

//COSTRUTTORE
videoplayer::videoplayer(QWidget *parent)
{
	stoptick = false;

	signalMapper = new QSignalMapper(this);

	createMenu();	

    //includendo gli oggetti menu, bottoni e frame video in QVBoxLayout che li ordina verticalmente
    QVBoxLayout *mainLayout = new QVBoxLayout;

    mainLayout->setMenuBar(menuBar);

    // creo il display LDC e la barra di scorrimento video

    // LCD
    QPalette palette;
    palette.setBrush(QPalette::Light, Qt::darkGray);

	//timerLCD = new QTimer(this);
    panelLCD = new QLCDNumber;
    panelLCD->setPalette(palette);

    //------------------------------------------------------------------
    //qui devo gestire l'lcd con il video
	//impongo che ogni secondo venga refreshato il pannello
	//connect(timerLCD, &QTimer::timeout, this, &videoplayer::tick);
    //-------------------------------------------------------------------

    //Barra di scorrimento
    positionSlider = new QSlider(Qt::Horizontal);

    //Inglobo la barra e LCD in un contenitore che li mette io orizzontale
    QHBoxLayout *seekerLayout = new QHBoxLayout;
    seekerLayout->addWidget(positionSlider);
    seekerLayout->addWidget(panelLCD);
    //aggiungo il contenitore alla finestra principale
    mainLayout->addLayout(seekerLayout);

    //Ora mi occupo dei pulsati
    playAction = new QAction(style()->standardIcon(QStyle::SP_MediaPlay), tr("Play"), this);
    playAction->setShortcut(tr("Ctrl+P"));
    playAction->setDisabled(true);
    pauseAction = new QAction(style()->standardIcon(QStyle::SP_MediaPause), tr("Pause"), this);
    pauseAction->setShortcut(tr("Ctrl+A"));
    pauseAction->setDisabled(true);
    stopAction = new QAction(style()->standardIcon(QStyle::SP_MediaStop), tr("Stop"), this);
    stopAction->setShortcut(tr("Ctrl+S"));
    stopAction->setDisabled(true);
	skipforwardAction = new QAction(style()->standardIcon(QStyle::SP_MediaSkipForward), tr("SkipForward"), this);
    skipforwardAction->setShortcut(tr("Ctrl+S+F"));
    skipforwardAction->setDisabled(true);
	skipbackwardAction = new QAction(style()->standardIcon(QStyle::SP_MediaSkipBackward), tr("SkipBackward"), this);
    skipbackwardAction->setShortcut(tr("Ctrl+S+B"));
    skipbackwardAction->setDisabled(true);
	seekforwardAction = new QAction(style()->standardIcon(QStyle::SP_MediaSeekForward), tr("SeekForward"), this);
    seekforwardAction->setShortcut(tr("Ctrl+F"));
    seekforwardAction->setDisabled(true);
	seekbackwardAction = new QAction(style()->standardIcon(QStyle::SP_MediaSeekBackward), tr("SeekBackward"), this);
    seekbackwardAction->setShortcut(tr("Ctrl+B"));
    seekbackwardAction->setDisabled(true);

	histoAction = new QAction(QIcon(":/images/histogram2.png"), tr("histo"), this);
	logAction = new QAction(QIcon(":/images/log.png"), tr("log"), this);

	histoAction->setDisabled(true);
	logAction->setDisabled(true);


	//event listener dei pulsanti
	connect(playAction, &QAction::triggered, this, &videoplayer::resume);
	connect(this, &videoplayer::first_play, this, &videoplayer::playing);
	connect(pauseAction, &QAction::triggered, this, &videoplayer::pause);
	connect(histoAction, &QAction::triggered, this, &videoplayer::histoClicked);
	connect(logAction, &QAction::triggered, this, &videoplayer::openDialog);

	/**
	utilizzo di un signalMapper per collegare l'evento di pressione dei pulsanti SEEK,
	con un particolare valore che verra inviato allo SLOT seek
	*/
	signalMapper->setMapping(seekforwardAction, 10);
	signalMapper->setMapping(seekbackwardAction, -10);
	signalMapper->setMapping(skipbackwardAction, -60);
	signalMapper->setMapping(skipforwardAction, 60);

	connect(skipforwardAction, SIGNAL(triggered()), signalMapper, SLOT(map()));
	connect(seekforwardAction, SIGNAL(triggered()), signalMapper, SLOT(map()));
	connect(skipbackwardAction, SIGNAL(triggered()), signalMapper, SLOT(map()));
	connect(seekbackwardAction, SIGNAL(triggered()), signalMapper, SLOT(map()));

	connect(signalMapper, SIGNAL(mapped(int)), this, SLOT(seek(int)));

    QToolBar *bar = new QToolBar;
    bar->addAction(playAction);
    bar->addAction(pauseAction);
    bar->addAction(stopAction);
	bar->addAction(skipbackwardAction);
	bar->addAction(seekbackwardAction);
	bar->addAction(seekforwardAction);
//.........这里部分代码省略.........
开发者ID:DarellAdams,项目名称:simplevideoplayer,代码行数:101,代码来源:videoplayer.cpp

示例12: Tool

MapTool::MapTool(ToolManager *toolManager)
    : Tool(toolManager)
    ,
    //		keepRatio_(true),
    //		lastX_(0.0),
    //		lastY_(0.0),
    //		lastWidth_(100.0),
    //		lastHeight_(100.0),
    active_(false)
{
    // Connect //
    //
    connect(this, SIGNAL(toolAction(ToolAction *)), toolManager, SLOT(toolActionSlot(ToolAction *)));

    QLabel *opacityLabel = new QLabel(" Opacity: ");

    opacityComboBox_ = new QComboBox();
    QStringList opacities;
    opacities << tr("100%") << tr("90%") << tr("80%") << tr("70%") << tr("60%") << tr("50%") << tr("40%") << tr("30%") << tr("20%") << tr("10%");
    opacityComboBox_->addItems(opacities);
    opacityComboBox_->setCurrentIndex(0);
    opacityComboBox_->setStatusTip(tr("Set Map Opacity."));
    opacityComboBox_->setToolTip(tr("Set Map Opacity"));
    connect(opacityComboBox_, SIGNAL(currentIndexChanged(QString)), this, SLOT(setOpacity(QString)));

    loadMapAction_ = new QAction(tr("Load &Map"), this);
    loadMapAction_->setStatusTip(tr("Load a background image."));
    connect(loadMapAction_, SIGNAL(triggered()), this, SLOT(loadMap()));

    deleteMapAction_ = new QAction(tr("&Delete Map"), this);
    deleteMapAction_->setStatusTip(tr("Delete the selected background images."));
    connect(deleteMapAction_, SIGNAL(triggered()), this, SLOT(deleteMap()));

    lockMapAction_ = new QAction(tr("&Lock Maps"), this);
    lockMapAction_->setStatusTip(tr("Toggle locking of the maps."));
    lockMapAction_->setCheckable(true);
    lockMapAction_->setChecked(true);
    connect(lockMapAction_, SIGNAL(triggered(bool)), this, SLOT(lockMap(bool)));

    //	QLabel * xLabel = new QLabel(" x: ");
    //	xLineEdit_ = new QDoubleSpinBox();
    //	xLineEdit_->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    //	xLineEdit_->setRange(-1000000.0, 1000000.0);
    //	xLineEdit_->setValue(lastX_);
    //	xLineEdit_->setMinimumWidth(100);
    //	xLineEdit_->setMaximumWidth(100);
    //	connect(xLineEdit_, SIGNAL(editingFinished()), this, SLOT(setX()));

    //	QLabel * yLabel = new QLabel(" y: ");
    //	yLineEdit_ = new QDoubleSpinBox();
    //	yLineEdit_->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    //	yLineEdit_->setRange(-1000000.0, 1000000.0);
    //	yLineEdit_->setValue(lastY_);
    //	yLineEdit_->setMinimumWidth(100);
    //	yLineEdit_->setMaximumWidth(100);
    //	connect(yLineEdit_, SIGNAL(editingFinished()), this, SLOT(setY()));

    //	QLabel * wLabel = new QLabel(" w: ");
    //	widthLineEdit_ = new QDoubleSpinBox();
    //	widthLineEdit_->setRange(1.0, 1000000.0);
    //	widthLineEdit_->setValue(lastWidth_);
    //	widthLineEdit_->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    //	widthLineEdit_->setMinimumWidth(100);
    //	widthLineEdit_->setMaximumWidth(100);
    //	connect(widthLineEdit_, SIGNAL(editingFinished()), this, SLOT(setWidth()));

    //	QLabel * hLabel = new QLabel(" h: ");
    //	heightLineEdit_ = new QDoubleSpinBox();
    //	heightLineEdit_->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    //	heightLineEdit_->setRange(1.0, 1000000.0);
    //	heightLineEdit_->setValue(lastHeight_);
    //	heightLineEdit_->setMinimumWidth(100);
    //	heightLineEdit_->setMaximumWidth(100);
    //	connect(heightLineEdit_, SIGNAL(editingFinished()), this, SLOT(setHeight()));

    // Deactivate if no project //
    //
    connect(ODD::instance()->mainWindow(), SIGNAL(hasActiveProject(bool)), this, SLOT(activateProject(bool)));

    // ToolBar //
    //
    QToolBar *mapToolBar = new QToolBar(tr("Map"));
    mapToolBar->addWidget(opacityLabel);
    mapToolBar->addWidget(opacityComboBox_);
    mapToolBar->addAction(loadMapAction_);
    mapToolBar->addAction(deleteMapAction_);
    mapToolBar->addAction(lockMapAction_);
    //	mapToolBar->addWidget(xLabel);
    //	mapToolBar->addWidget(xLineEdit_);
    //	mapToolBar->addWidget(yLabel);
    //	mapToolBar->addWidget(yLineEdit_);
    //	mapToolBar->addWidget(wLabel);
    //	mapToolBar->addWidget(widthLineEdit_);
    //	mapToolBar->addWidget(hLabel);
    //	mapToolBar->addWidget(heightLineEdit_);

    // ToolManager //
    //
    ODD::instance()->mainWindow()->addToolBar(mapToolBar);

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

示例13: setupTextActions

void TextEdit::setupTextActions()
{
  QToolBar *tb = new QToolBar(this);
  tb->setWindowTitle(tr("Format Actions"));
  addToolBar(tb);

//  QMenu *menu = new QMenu(tr("F&ormat"), this);
//  menuBar()->addMenu(menu);

  actionTextBold = new QAction(QIcon::fromTheme("format-text-bold", QIcon(rsrcPath + "/textbold.png")),
                               tr("&Bold"), this);
  actionTextBold->setShortcut(Qt::CTRL + Qt::Key_B);
  actionTextBold->setPriority(QAction::LowPriority);
  QFont bold;
  bold.setBold(true);
  actionTextBold->setFont(bold);
  connect(actionTextBold, SIGNAL(triggered()), this, SLOT(textBold()));
  tb->addAction(actionTextBold);
//  menu->addAction(actionTextBold);
  actionTextBold->setCheckable(true);
  //inifontsize
  actionTextDump = new QAction(QIcon::fromTheme("format-text-bold", QIcon(rsrcPath + "/textbold.png")),
                               tr("&Dump"), this);
  connect(actionTextDump, SIGNAL(triggered()), this, SLOT(dividePages()));
  tb->addAction(actionTextDump);
//  menu->addAction(actionTextDump);

  actionTextItalic = new QAction(QIcon::fromTheme("format-text-italic", QIcon(rsrcPath + "/textitalic.png")),
                                 tr("&Italic"), this);
  actionTextItalic->setPriority(QAction::LowPriority);
  actionTextItalic->setShortcut(Qt::CTRL + Qt::Key_I);
  QFont italic;
  italic.setItalic(true);
  actionTextItalic->setFont(italic);
  connect(actionTextItalic, SIGNAL(triggered()), this, SLOT(textItalic()));
  tb->addAction(actionTextItalic);
//  menu->addAction(actionTextItalic);
  actionTextItalic->setCheckable(true);

  actionTextUnderline = new QAction(QIcon::fromTheme("format-text-underline", QIcon(rsrcPath + "/textunder.png")),
                                    tr("&Underline"), this);
  actionTextUnderline->setShortcut(Qt::CTRL + Qt::Key_U);
  actionTextUnderline->setPriority(QAction::LowPriority);
  QFont underline;
  underline.setUnderline(true);
  actionTextUnderline->setFont(underline);
  connect(actionTextUnderline, SIGNAL(triggered()), this, SLOT(textUnderline()));
  tb->addAction(actionTextUnderline);
//  menu->addAction(actionTextUnderline);
  actionTextUnderline->setCheckable(true);

//  menu->addSeparator();

  QActionGroup *grp = new QActionGroup(this);
  connect(grp, SIGNAL(triggered(QAction*)), this, SLOT(textAlign(QAction*)));

  // Make sure the alignLeft  is always left of the alignRight
  if (QApplication::isLeftToRight()) {
    actionAlignLeft = new QAction(QIcon::fromTheme("format-justify-left", QIcon(rsrcPath + "/textleft.png")),
                                  tr("&Left"), grp);
    actionAlignCenter = new QAction(QIcon::fromTheme("format-justify-center", QIcon(rsrcPath + "/textcenter.png")), tr("C&enter"), grp);
    actionAlignRight = new QAction(QIcon::fromTheme("format-justify-right", QIcon(rsrcPath + "/textright.png")), tr("&Right"), grp);
  } else {
    actionAlignRight = new QAction(QIcon::fromTheme("format-justify-right", QIcon(rsrcPath + "/textright.png")), tr("&Right"), grp);
    actionAlignCenter = new QAction(QIcon::fromTheme("format-justify-center", QIcon(rsrcPath + "/textcenter.png")), tr("C&enter"), grp);
    actionAlignLeft = new QAction(QIcon::fromTheme("format-justify-left", QIcon(rsrcPath + "/textleft.png")), tr("&Left"), grp);
  }
  actionAlignJustify = new QAction(QIcon::fromTheme("format-justify-fill", QIcon(rsrcPath + "/textjustify.png")), tr("&Justify"), grp);

  actionAlignLeft->setShortcut(Qt::CTRL + Qt::Key_L);
  actionAlignLeft->setCheckable(true);
  actionAlignLeft->setPriority(QAction::LowPriority);
  actionAlignCenter->setShortcut(Qt::CTRL + Qt::Key_E);
  actionAlignCenter->setCheckable(true);
  actionAlignCenter->setPriority(QAction::LowPriority);
  actionAlignRight->setShortcut(Qt::CTRL + Qt::Key_R);
  actionAlignRight->setCheckable(true);
  actionAlignRight->setPriority(QAction::LowPriority);
  actionAlignJustify->setShortcut(Qt::CTRL + Qt::Key_J);
  actionAlignJustify->setCheckable(true);
  actionAlignJustify->setPriority(QAction::LowPriority);

  tb->addActions(grp->actions());
//  menu->addActions(grp->actions());

//  menu->addSeparator();

  QPixmap pix(16, 16);
  pix.fill(Qt::black);
  actionTextColor = new QAction(pix, tr("&Color..."), this);
  connect(actionTextColor, SIGNAL(triggered()), this, SLOT(textColor()));
  tb->addAction(actionTextColor);
//  menu->addAction(actionTextColor);


  tb = new QToolBar(this);
  tb->setAllowedAreas(Qt::TopToolBarArea | Qt::BottomToolBarArea);
  tb->setWindowTitle(tr("Format Actions"));
  addToolBarBreak(Qt::TopToolBarArea);
  addToolBar(tb);
//.........这里部分代码省略.........
开发者ID:counterstriker,项目名称:qtapplications,代码行数:101,代码来源:textedit.cpp

示例14: 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()));
}
开发者ID:andresmmera,项目名称:qucs,代码行数:81,代码来源:qucshelp.cpp

示例15: connect

MessagesSettingsPage::MessagesSettingsPage()
{
    chatMentionCheckBox.setChecked(settingsCache->getChatMention());
    connect(&chatMentionCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setChatMention(int)));

    chatMentionCompleterCheckbox.setChecked(settingsCache->getChatMentionCompleter());
    connect(&chatMentionCompleterCheckbox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setChatMentionCompleter(int)));
    
    ignoreUnregUsersMainChat.setChecked(settingsCache->getIgnoreUnregisteredUsers());
    ignoreUnregUserMessages.setChecked(settingsCache->getIgnoreUnregisteredUserMessages());
    connect(&ignoreUnregUsersMainChat, SIGNAL(stateChanged(int)), settingsCache, SLOT(setIgnoreUnregisteredUsers(int)));
    connect(&ignoreUnregUserMessages, SIGNAL(stateChanged(int)), settingsCache, SLOT(setIgnoreUnregisteredUserMessages(int)));
    
    invertMentionForeground.setChecked(settingsCache->getChatMentionForeground());
    connect(&invertMentionForeground, SIGNAL(stateChanged(int)), this, SLOT(updateTextColor(int)));

    invertHighlightForeground.setChecked(settingsCache->getChatHighlightForeground());
    connect(&invertHighlightForeground, SIGNAL(stateChanged(int)), this, SLOT(updateTextHighlightColor(int)));

    mentionColor = new QLineEdit();
    mentionColor->setText(settingsCache->getChatMentionColor());
    updateMentionPreview();
    connect(mentionColor, SIGNAL(textChanged(QString)), this, SLOT(updateColor(QString)));

    messagePopups.setChecked(settingsCache->getShowMessagePopup());
    connect(&messagePopups, SIGNAL(stateChanged(int)), settingsCache, SLOT(setShowMessagePopups(int)));

    mentionPopups.setChecked(settingsCache->getShowMentionPopup());
    connect(&mentionPopups, SIGNAL(stateChanged(int)), settingsCache, SLOT(setShowMentionPopups(int)));

    roomHistory.setChecked(settingsCache->getRoomHistory());
    connect(&roomHistory, SIGNAL(stateChanged(int)), settingsCache, SLOT(setRoomHistory(int)));

    customAlertString = new QLineEdit();
    customAlertString->setPlaceholderText("Word1 Word2 Word3");
    customAlertString->setText(settingsCache->getHighlightWords());
    connect(customAlertString, SIGNAL(textChanged(QString)), settingsCache, SLOT(setHighlightWords(QString)));

    QGridLayout *chatGrid = new QGridLayout;
    chatGrid->addWidget(&chatMentionCheckBox, 0, 0);
    chatGrid->addWidget(&invertMentionForeground, 0, 1);
    chatGrid->addWidget(mentionColor, 0, 2);
    chatGrid->addWidget(&chatMentionCompleterCheckbox, 1, 0);
    chatGrid->addWidget(&ignoreUnregUsersMainChat, 2, 0);
    chatGrid->addWidget(&hexLabel, 1, 2);
    chatGrid->addWidget(&ignoreUnregUserMessages, 3, 0);
    chatGrid->addWidget(&messagePopups, 4, 0);
    chatGrid->addWidget(&mentionPopups, 5, 0);
    chatGrid->addWidget(&roomHistory, 6, 0);
    chatGroupBox = new QGroupBox;
    chatGroupBox->setLayout(chatGrid);
    
    highlightColor = new QLineEdit();
    highlightColor->setText(settingsCache->getChatHighlightColor());
    updateHighlightPreview();
    connect(highlightColor, SIGNAL(textChanged(QString)), this, SLOT(updateHighlightColor(QString)));

    QGridLayout *highlightNotice = new QGridLayout;
    highlightNotice->addWidget(highlightColor, 0, 2);
    highlightNotice->addWidget(&invertHighlightForeground, 0, 1);
    highlightNotice->addWidget(&hexHighlightLabel, 1, 2);
    highlightNotice->addWidget(customAlertString, 0, 0);
    highlightNotice->addWidget(&customAlertStringLabel, 1, 0);
    highlightGroupBox = new QGroupBox;
    highlightGroupBox->setLayout(highlightNotice);

    messageList = new QListWidget;

    int count = settingsCache->messages().getCount();
    for (int i = 0; i < count; i++)
        messageList->addItem(settingsCache->messages().getMessageAt(i));
    
    aAdd = new QAction(this);
    aAdd->setIcon(QPixmap("theme:icons/increment"));
    connect(aAdd, SIGNAL(triggered()), this, SLOT(actAdd()));
    aRemove = new QAction(this);
    aRemove->setIcon(QPixmap("theme:icons/decrement"));
    connect(aRemove, SIGNAL(triggered()), this, SLOT(actRemove()));

    QToolBar *messageToolBar = new QToolBar;
    messageToolBar->setOrientation(Qt::Vertical);
    messageToolBar->addAction(aAdd);
    messageToolBar->addAction(aRemove);

    QHBoxLayout *messageListLayout = new QHBoxLayout;
    messageListLayout->addWidget(messageToolBar);
    messageListLayout->addWidget(messageList);

    messageShortcuts = new QGroupBox;
    messageShortcuts->setLayout(messageListLayout);

    QVBoxLayout *mainLayout = new QVBoxLayout;

    mainLayout->addWidget(messageShortcuts);
    mainLayout->addWidget(chatGroupBox);
    mainLayout->addWidget(highlightGroupBox);

    setLayout(mainLayout);
    
    retranslateUi();
//.........这里部分代码省略.........
开发者ID:DINKIN,项目名称:Cockatrice,代码行数:101,代码来源:dlg_settings.cpp


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