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


C++ setCentralWidget函数代码示例

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


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

示例1: QMainWindow

PdfViewer::PdfViewer()
    : QMainWindow()
	, m_currentPage(0)
	, m_showMenuBar(false)
	, m_reloadTimer(0)
	, m_findWidget(0)
{
//QTime t = QTime::currentTime();
    setWindowTitle(QCoreApplication::applicationName());

	// set icon theme search paths
    QStringList themeSearchPaths;
    themeSearchPaths << QDir::homePath() + "/.local/share/icons/";
    themeSearchPaths << QIcon::themeSearchPaths();
    QIcon::setThemeSearchPaths(themeSearchPaths);

	// setup shortcut handler
#ifndef QT_NO_SHORTCUT
	ShortcutHandler *shortcutHandler = new ShortcutHandler(this);
#endif // QT_NO_SHORTCUT
	QSettings *settingsObject = new QSettings(this);
#ifndef QT_NO_SHORTCUT
	shortcutHandler->setSettingsObject(settingsObject);
#endif // QT_NO_SHORTCUT

	// setup recent files menu
	m_fileOpenRecentAction = new RecentFilesAction(Icon("document-open-recent"), tr("Open &Recent", "Action: open recent file"), this);
	m_fileOpenRecentAction->setSettingsObject(settingsObject);
	connect(m_fileOpenRecentAction, SIGNAL(fileSelected(QString)), this, SLOT(slotLoadDocument(QString)));

	// setup the main view
	m_pdfView = new PdfView(this);
	connect(m_pdfView, SIGNAL(scrollPositionChanged(qreal,int)), this, SLOT(slotViewScrollPositionChanged(qreal,int)));
	connect(m_pdfView, SIGNAL(openTexDocument(QString,int)), this, SLOT(slotOpenTexDocument(QString,int)));
	connect(m_pdfView, SIGNAL(mouseToolChanged(PdfView::MouseTool)), this, SLOT(slotSelectMouseTool(PdfView::MouseTool)));


	// setup the central widget
	QWidget *mainWidget = new QWidget(this);
	QVBoxLayout *mainLayout = new QVBoxLayout;
	mainLayout->addWidget(m_pdfView);
	mainLayout->setContentsMargins(0, 0, 0, 0);
	mainLayout->setSpacing(0);
	mainWidget->setLayout(mainLayout);
	setCentralWidget(mainWidget);

	createActions(); // must happen after the setup of m_pdfView
	QSettings settings;
	settings.beginGroup("MainWindow");
	m_showMenuBar = settings.value("ShowMenuBar", false).toBool();
	settings.endGroup();
	if (m_showMenuBar)
	{
		createMenus();
		createToolBars();
	}
	else
		createToolBarsWhenNoMenuBar();
	createDocks();

    Q_FOREACH(DocumentObserver *obs, m_observers) {
        obs->m_viewer = this;
    }

    // activate AA by default
    m_settingsTextAAAction->setChecked(true);
    m_settingsGfxAAAction->setChecked(true);

	// watch file changes
	m_watcher = new QFileSystemWatcher(this);
    // commented out by amkhlv:
    // connect(m_watcher, SIGNAL(fileChanged(QString)), this, SLOT(slotReloadWhenIdle(QString)));

	// setup presentation view (we must do this here in order to have access to the shortcuts)
	m_presentationWidget = new PresentationWidget;
	connect(m_presentationWidget, SIGNAL(pageChanged(int)), this, SLOT(slotGoToPage(int)));
	connect(m_presentationWidget, SIGNAL(doAction(Poppler::LinkAction::ActionType)), this, SLOT(slotDoAction(Poppler::LinkAction::ActionType)));

	readSettings();
	m_pdfView->setFocus();
//qCritical() << t.msecsTo(QTime::currentTime());
}
开发者ID:amkhlv,项目名称:pdfviewer,代码行数:82,代码来源:viewer.cpp

示例2: setWindowTitle


//.........这里部分代码省略.........
                    QKeySequence(QKeySequence::Close));
    menu->addAction(tr("&Save Copy As..."),
                    storeDialog_, SLOT(open()),
                    QKeySequence(QKeySequence::Save));
    menu->addAction(tr("&Revert Scene"),
                    this, SLOT(revert()));
    menu->addSeparator();
    menu->addAction(tr("&Quit"), this, SLOT(close()),
                    QKeySequence(tr("ctrl-Q")));

    // Signal mapper for display types
    signalMapper_ = new QSignalMapper(this);

    // Add display menu
    QAction * action;
    menu = menuBar()->addMenu(tr("&Output Mode"));

    action = menu->addAction(tr("&Fullscreen"),
                             this, SLOT(toggleFullscreen()),
                             QKeySequence(Qt::Key_F | Qt::CTRL));
    fsGlWidget_->addAction(action);

    menu->addSeparator();

    action = menu->addAction(tr("&Anaglyph"));
    action->setShortcut(QKeySequence(Qt::Key_1 | Qt::CTRL));
    connect(action, SIGNAL(triggered()), signalMapper_, SLOT(map()));
    signalMapper_->setMapping(action, GLWidget::anaglyph);
    fsGlWidget_->addAction(action);

    action = menu->addAction(tr("&Side by Side"));
    action->setShortcut(QKeySequence(Qt::Key_2 | Qt::CTRL));
    connect(action, SIGNAL(triggered()), signalMapper_, SLOT(map()));
    signalMapper_->setMapping(action, GLWidget::sidebyside);
    fsGlWidget_->addAction(action);

    action = menu->addAction(tr("&Line interlacing (Experimental)"));
    action->setShortcut(QKeySequence(Qt::Key_3 | Qt::CTRL));
    connect(action, SIGNAL(triggered()), signalMapper_, SLOT(map()));
    signalMapper_->setMapping(action, GLWidget::line);
    fsGlWidget_->addAction(action);

    action = menu->addAction(tr("Quad Buffering (Experimental)"));
    action->setShortcut(QKeySequence(Qt::Key_4 | Qt::CTRL));
    connect(action, SIGNAL(triggered()), signalMapper_, SLOT(map()));
    signalMapper_->setMapping(action, GLWidget::quad);
    fsGlWidget_->addAction(action);

    action = menu->addAction(tr("Matrix Anaglyph (Experimental)"));
    action->setShortcut(QKeySequence(Qt::Key_5 | Qt::CTRL));
    connect(action, SIGNAL(triggered()), signalMapper_, SLOT(map()));
    signalMapper_->setMapping(action, GLWidget::matrix);
    fsGlWidget_->addAction(action);

    menu->addSeparator();

    action = menu->addAction(tr("&Shader (Line interlacing)"));
    action->setShortcut(QKeySequence(Qt::Key_6 | Qt::CTRL));
    connect(action, SIGNAL(triggered()), signalMapper_, SLOT(map()));
    signalMapper_->setMapping(action, GLWidget::shaderLine);
    fsGlWidget_->addAction(action);

    action = menu->addAction(tr("&Shader (Mayan)"));
    action->setShortcut(QKeySequence(Qt::Key_7 | Qt::CTRL));
    connect(action, SIGNAL(triggered()), signalMapper_, SLOT(map()));
    signalMapper_->setMapping(action, GLWidget::shaderMayan);
    fsGlWidget_->addAction(action);

    menu->addSeparator();

    action = menu->addAction(tr("Si&ngle"));
    action->setShortcut(QKeySequence(Qt::Key_0 | Qt::CTRL));
    connect(action, SIGNAL(triggered()), signalMapper_, SLOT(map()));
    signalMapper_->setMapping(action, GLWidget::single);
    fsGlWidget_->addAction(action);

    connect(signalMapper_, SIGNAL(mapped(int)), this, SLOT(setDrawStyle(int)));

    // Object Creation Menu and signal mapper
    objectMenu_ = menuBar()->addMenu(tr("&Create Object"));
    objectMapper_ = new QSignalMapper(this);
    connect(objectMapper_, SIGNAL(mapped(int)), this, SLOT(onObjectCreate(int)));

#ifdef Q_WS_MACX
    // Make menu bar the default menu bar
    menuBar()->setParent(0);
#endif

    // Set up layout
    setFocusPolicy(Qt::StrongFocus);
    setCentralWidget(mainGlWidget_);

    // Create Scene
    setProgram(Program::create());

    // Set up redraw timer
    timer_ = new QTimer(this);
    connect(timer_, SIGNAL(timeout()), this, SLOT(onTimeout()));
    timer_->start(15); // ~60 fps
}
开发者ID:cbreak-black,项目名称:ExaminationRoom,代码行数:101,代码来源:mainwindow.cpp

示例3: QWidget

QucsFilter::QucsFilter()
{
  QWidget *centralWidget = new QWidget(this);  
  setCentralWidget(centralWidget);
  
  // set application icon
  setWindowIcon(QPixmap(":/bitmaps/big.qucs.xpm"));
  setWindowTitle("Qucs Filter " PACKAGE_VERSION);

  // --------  create menubar  -------------------
  QMenu *fileMenu = new QMenu(tr("&File"));

  QAction * fileQuit = new QAction(tr("E&xit"), this);
  fileQuit->setShortcut(Qt::CTRL+Qt::Key_Q);
  connect(fileQuit, SIGNAL(activated()), SLOT(slotQuit()));

  fileMenu->addAction(fileQuit);

  QMenu *helpMenu = new QMenu(tr("&Help"), this);
  QAction * helpHelp = new QAction(tr("Help..."), this);
  helpHelp->setShortcut(Qt::Key_F1);
  connect(helpHelp, SIGNAL(activated()), SLOT(slotHelpIntro()));

  QAction * helpAbout = new QAction(tr("&About QucsFilter..."), this);
  helpMenu->addAction(helpAbout);
  connect(helpAbout, SIGNAL(activated()), SLOT(slotHelpAbout()));

  QAction * helpAboutQt = new QAction(tr("About Qt..."), this);
  helpMenu->addAction(helpAboutQt);
  connect(helpAboutQt, SIGNAL(activated()), SLOT(slotHelpAboutQt()));

  helpMenu->addAction(helpHelp);
  helpMenu->addSeparator();
  helpMenu->addAction(helpAbout);
  helpMenu->addAction(helpAboutQt);

  menuBar()->addMenu(fileMenu);
  menuBar()->addSeparator();
  menuBar()->addMenu(helpMenu);

  // -------  create main windows widgets --------
  all  = new QGridLayout();
  all->setSpacing(3);

  // assign layout to central widget
  centralWidget->setLayout(all);

  // ...........................................................
  box1 = new QGroupBox(tr("Filter"), this);
  all->addWidget(box1,0,0);

  gbox1 = new QGridLayout();
  gbox1->setSpacing(3);

  box1->setLayout(gbox1);

  QLabel *Label0 = new QLabel(tr("Realization:"), this);
  gbox1->addWidget(Label0, 0,0);
  ComboRealize = new QComboBox(this);
  ComboRealize->addItem("LC ladder (pi type)");
  ComboRealize->addItem("LC ladder (tee type)");
  ComboRealize->addItem("C-coupled transmission lines");
  ComboRealize->addItem("Microstrip end-coupled");
  ComboRealize->addItem("Coupled transmission lines");
  ComboRealize->addItem("Coupled microstrip");
  ComboRealize->addItem("Stepped-impedance");
  ComboRealize->addItem("Stepped-impedance microstrip");
  ComboRealize->addItem("Quarter wave");
  ComboRealize->addItem("Quarter wave microstrip");
  ComboRealize->addItem("Equation-defined");

  gbox1->addWidget(ComboRealize, 0,1);
  connect(ComboRealize, SIGNAL(activated(int)), SLOT(slotRealizationChanged(int)));

  QLabel *Label1 = new QLabel(tr("Filter type:"), this);
  gbox1->addWidget(Label1, 1,0);
  ComboType = new QComboBox(this);
  ComboType->addItem("Bessel");
  ComboType->addItem("Butterworth");
  ComboType->addItem("Chebyshev");
  ComboType->addItem("Cauer");
  gbox1->addWidget(ComboType, 1,1);
  connect(ComboType, SIGNAL(activated(int)), SLOT(slotTypeChanged(int)));

  QLabel *Label2 = new QLabel(tr("Filter class:"), this);
  gbox1->addWidget(Label2, 2,0);
  ComboClass = new QComboBox(this);
  ComboClass->addItem(tr("Low pass"));
  ComboClass->addItem(tr("High pass"));
  ComboClass->addItem(tr("Band pass"));
  ComboClass->addItem(tr("Band stop"));
  gbox1->addWidget(ComboClass, 2,1);
  connect(ComboClass, SIGNAL(activated(int)), SLOT(slotClassChanged(int)));

  IntVal = new QIntValidator(1, 200, this);
  DoubleVal = new QDoubleValidator(this);

  LabelOrder = new QLabel(tr("Order:"), this);
  gbox1->addWidget(LabelOrder, 3,0);
  EditOrder = new QLineEdit("3", this);
//.........这里部分代码省略.........
开发者ID:FoxMarts,项目名称:qucs,代码行数:101,代码来源:qucsfilter.cpp

示例4: QMainWindow

BitcoinGUI::BitcoinGUI(QWidget *parent):
    QMainWindow(parent),
    clientModel(0),
    walletModel(0),
    encryptWalletAction(0),
    changePassphraseAction(0),
    aboutQtAction(0),
    trayIcon(0),
    notificator(0),
    rpcConsole(0)
{
    resize(850, 550);
    setWindowTitle(tr("Redcoin") + " - " + tr("Wallet"));
#ifndef Q_WS_MAC
    qApp->setWindowIcon(QIcon(":icons/bitcoin"));
    setWindowIcon(QIcon(":icons/bitcoin"));
#else
    setUnifiedTitleAndToolBarOnMac(true);
    QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
#endif
    // Accept D&D of URIs
    setAcceptDrops(true);

    // Create actions for the toolbar, menu bar and tray/dock icon
    createActions();

    // Create application menu bar
    createMenuBar();

    // Create the toolbars
    createToolBars();

    // Create the tray icon (or setup the dock icon)
    createTrayIcon();

    // Create tabs
    overviewPage = new OverviewPage();

    miningPage = new MiningPage(this);

    transactionsPage = new QWidget(this);
    QVBoxLayout *vbox = new QVBoxLayout();
    transactionView = new TransactionView(this);
    vbox->addWidget(transactionView);
    transactionsPage->setLayout(vbox);

    addressBookPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::SendingTab);

    receiveCoinsPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::ReceivingTab);

    sendCoinsPage = new SendCoinsDialog(this);

    signVerifyMessageDialog = new SignVerifyMessageDialog(this);

    centralWidget = new QStackedWidget(this);
    centralWidget->addWidget(overviewPage);
    centralWidget->addWidget(miningPage);
    centralWidget->addWidget(transactionsPage);
    centralWidget->addWidget(addressBookPage);
    centralWidget->addWidget(receiveCoinsPage);
    centralWidget->addWidget(sendCoinsPage);
#ifdef FIRST_CLASS_MESSAGING
    centralWidget->addWidget(signVerifyMessageDialog);
#endif
    setCentralWidget(centralWidget);

    // Create status bar
    statusBar();

    // Status bar notification icons
    QFrame *frameBlocks = new QFrame();
    frameBlocks->setContentsMargins(0,0,0,0);
    frameBlocks->setMinimumWidth(73);
    frameBlocks->setMaximumWidth(73);
    QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks);
    frameBlocksLayout->setContentsMargins(3,0,3,0);
    frameBlocksLayout->setSpacing(3);
    labelEncryptionIcon = new QLabel();
    labelMiningIcon = new QLabel();
    labelConnectionsIcon = new QLabel();
    labelBlocksIcon = new QLabel();
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelEncryptionIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelMiningIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelConnectionsIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelBlocksIcon);
    frameBlocksLayout->addStretch();

    // Progress bar and label for blocks download
    progressBarLabel = new QLabel();
    progressBarLabel->setVisible(false);
    progressBar = new QProgressBar();
    progressBar->setAlignment(Qt::AlignCenter);
    progressBar->setVisible(false);

    statusBar()->addWidget(progressBarLabel);
    statusBar()->addWidget(progressBar);
//.........这里部分代码省略.........
开发者ID:CCPorg,项目名称:RED-RedCoin-Ver-603-Copy,代码行数:101,代码来源:bitcoingui.cpp

示例5: QMainWindow

BitcoinGUI::BitcoinGUI(QWidget *parent):
    QMainWindow(parent),
    clientModel(0),
    walletModel(0),
    encryptWalletAction(0),
    changePassphraseAction(0),
    aboutQtAction(0),
    trayIcon(0),
    notificator(0),
    rpcConsole(0)
{
    resize(850, 550);
    setWindowTitle(tr("Blackwhitecoin") + " - " + tr("Wallet"));
#ifndef Q_OS_MAC
    qApp->setWindowIcon(QIcon(":icons/bitcoin"));
    setWindowIcon(QIcon(":icons/bitcoin"));
#else
    setUnifiedTitleAndToolBarOnMac(true);
    QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
#endif
    // Accept D&D of URIs
    setAcceptDrops(true);

    // Create actions for the toolbar, menu bar and tray/dock icon
    createActions();

    // Create application menu bar
    createMenuBar();

    // Create the toolbars
    createToolBars();

    // Create the tray icon (or setup the dock icon)
    createTrayIcon();

    // Create tabs
    overviewPage = new OverviewPage();

    transactionsPage = new QWidget(this);
    QVBoxLayout *vbox = new QVBoxLayout();
    transactionView = new TransactionView(this);
    vbox->addWidget(transactionView);
    transactionsPage->setLayout(vbox);

    addressBookPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::SendingTab);

    receiveCoinsPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::ReceivingTab);

    sendCoinsPage = new SendCoinsDialog(this);

    signVerifyMessageDialog = new SignVerifyMessageDialog(this);

    centralWidget = new QStackedWidget(this);
    centralWidget->addWidget(overviewPage);
    centralWidget->addWidget(transactionsPage);
    centralWidget->addWidget(addressBookPage);
    centralWidget->addWidget(receiveCoinsPage);
    centralWidget->addWidget(sendCoinsPage);
    setCentralWidget(centralWidget);

    // Create status bar
    statusBar();

    // Status bar notification icons
    QFrame *frameBlocks = new QFrame();
    frameBlocks->setContentsMargins(0,0,0,0);
    frameBlocks->setMinimumWidth(56);
    frameBlocks->setMaximumWidth(56);
    QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks);
    frameBlocksLayout->setContentsMargins(3,0,3,0);
    frameBlocksLayout->setSpacing(3);
    labelEncryptionIcon = new QLabel();
    labelConnectionsIcon = new QLabel();
    labelBlocksIcon = new QLabel();
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelEncryptionIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelConnectionsIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelBlocksIcon);
    frameBlocksLayout->addStretch();

    // Progress bar and label for blocks download
    progressBarLabel = new QLabel();
    progressBarLabel->setVisible(false);
    progressBar = new QProgressBar();
    progressBar->setAlignment(Qt::AlignCenter);
    progressBar->setVisible(false);

    // Override style sheet for progress bar for styles that have a segmented progress bar,
    // as they make the text unreadable (workaround for issue #1071)
    // See https://qt-project.org/doc/qt-4.8/gallery.html
    QString curStyle = qApp->style()->metaObject()->className();
    if(curStyle == "QWindowsStyle" || curStyle == "QWindowsXPStyle")
    {
        progressBar->setStyleSheet("QProgressBar { background-color: #e8e8e8; border: 1px solid grey; border-radius: 7px; padding: 1px; text-align: center; } QProgressBar::chunk { background: QLinearGradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #FF8000, stop: 1 orange); border-radius: 7px; margin: 0px; }");
    }

    statusBar()->addWidget(progressBarLabel);
    statusBar()->addWidget(progressBar);
//.........这里部分代码省略.........
开发者ID:blackwhitecoin,项目名称:Blackwhitecoin,代码行数:101,代码来源:bitcoingui.cpp

示例6: QMainWindow

//! [0]
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent), completer(0), lineEdit(0)
{
    createMenu();

    QWidget *centralWidget = new QWidget;

    QLabel *modelLabel = new QLabel;
    modelLabel->setText(tr("Model"));

    modelCombo = new QComboBox;
    modelCombo->addItem(tr("QFileSytemModel"));
    modelCombo->addItem(tr("QFileSytemModel that shows full path"));
    modelCombo->addItem(tr("Country list"));
    modelCombo->addItem(tr("Word list"));
    modelCombo->setCurrentIndex(0);

    QLabel *modeLabel = new QLabel;
    modeLabel->setText(tr("Completion Mode"));
    modeCombo = new QComboBox;
    modeCombo->addItem(tr("Inline"));
    modeCombo->addItem(tr("Filtered Popup"));
    modeCombo->addItem(tr("Unfiltered Popup"));
    modeCombo->setCurrentIndex(1);

    QLabel *caseLabel = new QLabel;
    caseLabel->setText(tr("Case Sensitivity"));
    caseCombo = new QComboBox;
    caseCombo->addItem(tr("Case Insensitive"));
    caseCombo->addItem(tr("Case Sensitive"));
    caseCombo->setCurrentIndex(0);
//! [0]

//! [1]
    QLabel *maxVisibleLabel = new QLabel;
    maxVisibleLabel->setText(tr("Max Visible Items"));
    maxVisibleSpinBox = new QSpinBox;
    maxVisibleSpinBox->setRange(3,25);
    maxVisibleSpinBox->setValue(10);

    wrapCheckBox = new QCheckBox;
    wrapCheckBox->setText(tr("Wrap around completions"));
    wrapCheckBox->setChecked(true);
//! [1]

//! [2]
    contentsLabel = new QLabel;
    contentsLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);

    connect(modelCombo, SIGNAL(activated(int)), this, SLOT(changeModel()));
    connect(modeCombo, SIGNAL(activated(int)), this, SLOT(changeMode(int)));
    connect(caseCombo, SIGNAL(activated(int)), this, SLOT(changeCase(int)));
    connect(maxVisibleSpinBox, SIGNAL(valueChanged(int)), this, SLOT(changeMaxVisible(int)));
//! [2]

//! [3]
    lineEdit = new QLineEdit;

    QGridLayout *layout = new QGridLayout;
    layout->addWidget(modelLabel, 0, 0); layout->addWidget(modelCombo, 0, 1);
    layout->addWidget(modeLabel, 1, 0);  layout->addWidget(modeCombo, 1, 1);
    layout->addWidget(caseLabel, 2, 0);  layout->addWidget(caseCombo, 2, 1);
    layout->addWidget(maxVisibleLabel, 3, 0); layout->addWidget(maxVisibleSpinBox, 3, 1);
    layout->addWidget(wrapCheckBox, 4, 0);
    layout->addWidget(contentsLabel, 5, 0, 1, 2);
    layout->addWidget(lineEdit, 6, 0, 1, 2);
    centralWidget->setLayout(layout);
    setCentralWidget(centralWidget);

    changeModel();

    setWindowTitle(tr("Completer"));
    lineEdit->setFocus();
}
开发者ID:CodeDJ,项目名称:qt5-hidpi,代码行数:75,代码来源:mainwindow.cpp

示例7: QMainWindow

MainWindow::MainWindow(Application *app)
    : QMainWindow(),
      m_application(app)
{
    app->setMainWindow(this);
    setUnifiedTitleAndToolBarOnMac(true);
    setDocumentMode(true);

    QCoreApplication::setOrganizationName("Dunnart");
    QCoreApplication::setOrganizationDomain("dunnart.org");
    QCoreApplication::setApplicationName("Dunnart");

    // Correct the look of the tab bar on OS X cocoa.
    app->setStyleSheet(
        "QGraphicsView {"
            "border: 0px;"
        "}"
#ifdef Q_WS_MAC
        "QTabBar::tab:top {"
            "font-family: \"Lucida Grande\";"
            "font-size: 11px;"
        "}"
#endif
    );

    // Set the window title.
    setWindowTitle("Dunnart");

    m_tab_widget = new CanvasTabWidget(this);    
    connect(m_tab_widget, SIGNAL(currentCanvasChanged(Canvas*)),
            this, SLOT(canvasChanged(Canvas*)));
    connect(m_tab_widget, SIGNAL(currentCanvasFileInfoChanged(QFileInfo)),
            this, SLOT(canvasFileInfoChanged(QFileInfo)));
    m_tab_widget->newTab();
    setCentralWidget(m_tab_widget);
    app->setCanvasTabWidget(m_tab_widget);

    // Inital window size.
    resize(1020, 743);

    m_new_action = new QAction("New", this);
    m_new_action->setShortcut(QKeySequence::New);
    connect(m_new_action, SIGNAL(triggered()), this, SLOT(documentNew()));

    m_open_action = new QAction("Open...", this);
    m_open_action->setShortcut(QKeySequence::Open);
    connect(m_open_action, SIGNAL(triggered()), this, SLOT(documentOpen()));

    for (int i = 0; i < MAX_RECENT_FILES; ++i)
    {
        m_action_open_recent_file[i] = new QAction(this);
        m_action_open_recent_file[i]->setVisible(false);
        connect(m_action_open_recent_file[i], SIGNAL(triggered()),
                this, SLOT(documentOpenRecent()));
    }

    m_close_action = new QAction("Close", this);
    m_close_action->setShortcut(QKeySequence::Close);
    connect(m_close_action, SIGNAL(triggered()),
            m_tab_widget, SLOT(currentCanvasClose()));

    m_save_action = new QAction("Save", this);
    m_save_action->setShortcut(QKeySequence::Save);
    connect(m_save_action, SIGNAL(triggered()),
            m_tab_widget, SLOT(currentCanvasSave()));

    m_save_as_action = new QAction("Save As...", this);
    m_save_as_action->setShortcut(QKeySequence::SaveAs);
    connect(m_save_as_action, SIGNAL(triggered()),
            m_tab_widget, SLOT(currentCanvasSaveAs()));

    m_export_action = new QAction("Export...", this);
    connect(m_export_action, SIGNAL(triggered()), this, SLOT(documentExport()));

    m_print_action = new QAction("Print...", this);
    m_print_action->setShortcut(QKeySequence::Print);
    connect(m_print_action, SIGNAL(triggered()), this, SLOT(documentPrint()));

    m_quit_action = new QAction(tr("Quit"), this);
    m_quit_action->setShortcut(QKeySequence::Quit);
    connect(m_quit_action, SIGNAL(triggered()),
            this, SLOT(close()));

    m_about_action = new QAction(tr("About"), this);
    connect(m_about_action, SIGNAL(triggered()), this, SLOT(about()));

    m_homepage_action = new QAction(tr("Dunnart homepage"), this);
    connect(m_homepage_action, SIGNAL(triggered()), this, SLOT(openHomepage()));

    m_action_show_zoom_level_dialog = new QAction(
            tr("Zoom Level"), this);
    m_action_show_zoom_level_dialog->setCheckable(true);

    m_action_show_properties_editor_dialog = new QAction(
            tr("Properties Editor"), this);
    m_action_show_properties_editor_dialog->setCheckable(true);

    m_action_show_layout_properties_dialog = new QAction(
            tr("Layout Properties"), this);
    m_action_show_layout_properties_dialog->setCheckable(true);
//.........这里部分代码省略.........
开发者ID:skieffer,项目名称:ortho,代码行数:101,代码来源:mainwindow.cpp

示例8: QMainWindow

BitcoinGUI::BitcoinGUI(QWidget *parent):
    QMainWindow(parent),
    clientModel(0),
    walletModel(0),
    encryptWalletAction(0),
    changePassphraseAction(0),
    unlockWalletAction(0),
    lockWalletAction(0),
    aboutQtAction(0),
    trayIcon(0),
    notificator(0),
    rpcConsole(0),
    nWeight(0)
{
    setFixedSize(970, 550);
	QFontDatabase::addApplicationFont(":/fonts/Bebas");
    setWindowTitle(tr("Pentacoin") + " - " + tr("Wallet"));
	qApp->setStyleSheet("QMainWindow { background-image:url(:images/bkg);border:none; } #frame { } QToolBar QLabel { padding-top: 0px;padding-bottom: 0px;spacing: 10px;} QToolBar QLabel:item { padding-top: 0px;padding-bottom: 0px;spacing: 10px;} #spacer { background: transparent;border:none; } #toolbar2 { border:none;width:0px;hight:0px;padding-top:40px;padding-bottom:0px; background-color: transparent; } #labelMiningIcon { padding-left:5px;font-family:Century Gothic;width:100%;font-size:10px;text-align:center;color:black; } QMenu { background-color: qlineargradient(spread:pad, x1:0.511, y1:1, x2:0.482909, y2:0, stop:0 rgba(232,232,232), stop:1 rgba(232,232,232)); color: black; padding-bottom:10px; } QMenu::item { color: black; background: transparent; } QMenu::item:selected { background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 rgba(99,99,99,45), stop: 1 rgba(99,99,99,45)); } QMenuBar { background-color: white; color: white; } QMenuBar::item { font-size:12px;padding-bottom:3px;padding-top:3px;padding-left:15px;padding-right:15px;color: black; background-color: white; } QMenuBar::item:selected { background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 rgba(99,99,99,45), stop: 1 rgba(99,99,99,45)); }");
#ifndef Q_OS_MAC
    qApp->setWindowIcon(QIcon(":icons/bitcoin"));
    setWindowIcon(QIcon(":icons/bitcoin"));
#else
    setUnifiedTitleAndToolBarOnMac(true);
    QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
#endif
    // Accept D&D of URIs
    setAcceptDrops(true);

    // Create actions for the toolbar, menu bar and tray/dock icon
    createActions();

    // Create application menu bar
    createMenuBar();

    // Create the toolbars
    createToolBars();

    // Create the tray icon (or setup the dock icon)
    createTrayIcon();

    // Create tabs
    overviewPage = new OverviewPage();

    transactionsPage = new QWidget(this);
    QVBoxLayout *vbox = new QVBoxLayout();
    transactionView = new TransactionView(this);
    vbox->addWidget(transactionView);
    transactionsPage->setLayout(vbox);

    addressBookPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::SendingTab);

    receiveCoinsPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::ReceivingTab);

    sendCoinsPage = new SendCoinsDialog(this);

    signVerifyMessageDialog = new SignVerifyMessageDialog(this);
    masternodeManagerPage = new MasternodeManager(this);

    centralWidget = new QStackedWidget(this);
    centralWidget->addWidget(overviewPage);
    centralWidget->addWidget(transactionsPage);
    centralWidget->addWidget(addressBookPage);
    centralWidget->addWidget(receiveCoinsPage);
    centralWidget->addWidget(sendCoinsPage);
    centralWidget->addWidget(masternodeManagerPage);
    setCentralWidget(centralWidget);

    // Create status bar
    statusBar();

    // Status bar notification icons
    QFrame *frameBlocks = new QFrame();
    frameBlocks->setContentsMargins(0,0,0,0);
    frameBlocks->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
    QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks);
    frameBlocksLayout->setContentsMargins(3,0,3,0);
    frameBlocksLayout->setSpacing(3);
    labelEncryptionIcon = new QLabel();
    labelStakingIcon = new QLabel();
    labelConnectionsIcon = new QLabel();
    labelBlocksIcon = new QLabel();
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelEncryptionIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelStakingIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelConnectionsIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelBlocksIcon);
    frameBlocksLayout->addStretch();

    if (GetBoolArg("-staking", true))
    {
        QTimer *timerStakingIcon = new QTimer(labelStakingIcon);
        connect(timerStakingIcon, SIGNAL(timeout()), this, SLOT(updateStakingIcon()));
        timerStakingIcon->start(30 * 1000);
        updateStakingIcon();
    }

    // Progress bar and label for blocks download
//.........这里部分代码省略.........
开发者ID:lin0sspice,项目名称:pentacoin,代码行数:101,代码来源:bitcoingui.cpp

示例9: QMainWindow

BitcoinGUI::BitcoinGUI(QWidget *parent):
    QMainWindow(parent),
    clientModel(0),
    walletModel(0),
    encryptWalletAction(0),
    changePassphraseAction(0),
    unlockWalletAction(0),
    lockWalletAction(0),
    aboutQtAction(0),
    trayIcon(0),
    notificator(0),
    rpcConsole(0)
{
    resize(840, 550);
    setWindowTitle(tr("Global ") + tr("Wallet"));


#ifndef Q_OS_MAC
    qApp->setWindowIcon(QIcon(":icons/bitcoin"));
    setWindowIcon(QIcon(":icons/bitcoin"));
#else
    setUnifiedTitleAndToolBarOnMac(true);
    QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
#endif
	QApplication::setStyle(QStyleFactory::create("Fusion"));

    // Accept D&D of URIs
    setAcceptDrops(true);

    // Create actions for the toolbar, menu bar and tray/dock icon
    createActions();

    // Create application menu bar
    createMenuBar();

    // Create the toolbars
    createToolBars();

    // Create the tray icon (or setup the dock icon)
    createTrayIcon();
//    QFile style(":/styles/styles");
//    style.open(QFile::ReadOnly);
//    qApp->setStyleSheet(QString::fromUtf8(style.readAll()));
//    setStyleSheet("QMainWindow { background-image:url(:images/bkg);border:none;font-family:'Open Sans,sans-serif'; } #frame { } QToolBar QLabel { padding-top:15px;padding-bottom:10px;margin:0px; } #spacer { background:rgb(210,192,123);border:none; } #toolbar3 { border:none;width:1px; background-color: rgb(63,109,186); } #toolbar2 { border:none;width:28px; background-color:qlineargradient(x1: 0, y1: 0, x2: 2, y2: 2,stop: 0 rgb(210,192,123), stop: 1 rgb(227,213,195),stop: 2 rgb(59,62,65)); } #toolbar { border:none;height:100%;padding-top:20px; background: rgb(210,192,123); text-align: left; color: white;min-width:150px;max-width:150px;} QToolBar QToolButton:hover {background-color:qlineargradient(x1: 0, y1: 0, x2: 2, y2: 2,stop: 0 rgb(210,192,123), stop: 1 rgb(227,213,195),stop: 2 rgb(59,62,65));} QToolBar QToolButton { font-family:Century Gothic;padding-left:20px;padding-right:150px;padding-top:10px;padding-bottom:10px; width:100%; color: white; text-align: left; background-color: rgb(210,192,123) } #labelMiningIcon { padding-left:5px;font-family:Century Gothic;width:100%;font-size:10px;text-align:center;color:white; } QMenu { background: rgb(210,192,123); color:white; padding-bottom:10px; } QMenu::item { color:white; background-color: transparent; } QMenu::item:selected { background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 rgb(210,192,123), stop: 1 rgb(227,213,195)); } QMenuBar { background: rgb(210,192,123); color:white; } QMenuBar::item { font-size:12px;padding-bottom:8px;padding-top:8px;padding-left:15px;padding-right:15px;color:white; background-color: transparent; } QMenuBar::item:selected { background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 rgb(210,192,123), stop: 1 rgb(227,213,195)); }");
    qApp->setStyleSheet("QMainWindow { background-image:url(:images/bkg);border:none;font-family:'Open Sans,sans-serif'; } #frame { } QToolBar QLabel { padding-top:15px;padding-bottom:10px;margin:0px; } #spacer { background:rgb(63,109,186);border:none; } #toolbar3 { border:none;width:1px; background-color: rgb(63,109,186); } #toolbar2 { border:none;width:28px; background-color:rgb(63,109,186); } #toolbar { border:none;height:100%;padding-top:20px; background: rgb(63,109,186); text-align: left; color: white;min-width:150px;max-width:150px;} QToolBar QToolButton:hover {background-color:qlineargradient(x1: 0, y1: 0, x2: 2, y2: 2,stop: 0 rgb(63,109,186), stop: 1 rgb(216,252,251),stop: 2 rgb(59,62,65));} QToolBar QToolButton { font-family:Century Gothic;padding-left:20px;padding-right:150px;padding-top:10px;padding-bottom:10px; width:100%; color: white; text-align: left; background-color: rgb(63,109,186) } #labelMiningIcon { padding-left:5px;font-family:Century Gothic;width:100%;font-size:10px;text-align:center;color:white; } QMenu { background: rgb(63,109,186); color:white; padding-bottom:10px; } QMenu::item { color:white; background-color: transparent; } QMenu::item:selected { background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 rgb(63,109,186), stop: 1 rgb(149,204,244)); } QMenuBar { background: rgb(63,109,186); color:white; } QMenuBar::item { font-size:12px;padding-bottom:8px;padding-top:8px;padding-left:15px;padding-right:15px;color:white; background-color: transparent; } QMenuBar::item:selected { background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 rgb(63,109,186), stop: 1 rgb(149,204,244)); }");


//#ifdef Q_OS_MAC
//    toolbar->setStyleSheet("QToolBar { background-color: transparent; border: 0px solid black; padding: 3px; }");
//#endif
    // Create tabs
    overviewPage = new OverviewPage();

    transactionsPage = new QWidget(this);
    QVBoxLayout *vbox = new QVBoxLayout();
    transactionView = new TransactionView(this);
    vbox->addWidget(transactionView);
    transactionsPage->setLayout(vbox);

    addressBookPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::SendingTab);

    receiveCoinsPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::ReceivingTab);

    sendCoinsPage = new SendCoinsDialog(this);

    signVerifyMessageDialog = new SignVerifyMessageDialog(this);

    centralWidget = new QStackedWidget(this);
    centralWidget->addWidget(overviewPage);
    centralWidget->addWidget(transactionsPage);
    centralWidget->addWidget(addressBookPage);
    centralWidget->addWidget(receiveCoinsPage);
    centralWidget->addWidget(sendCoinsPage);
    setCentralWidget(centralWidget);

    // Create status bar
    statusBar();

    // Status bar notification icons

    labelEncryptionIcon = new QLabel();
    labelStakingIcon = new QLabel();
    labelConnectionsIcon = new QLabel();
    labelBlocksIcon = new QLabel();

    if (GetBoolArg("-staking", true))
    {
        QTimer *timerStakingIcon = new QTimer(labelStakingIcon);
        connect(timerStakingIcon, SIGNAL(timeout()), this, SLOT(updateStakingIcon()));
        timerStakingIcon->start(30 * 1000);
        updateStakingIcon();
    }

    // Progress bar and label for blocks download
    progressBarLabel = new QLabel();
    progressBarLabel->setVisible(false);
    progressBar = new QProgressBar();


    progressBar->setAlignment(Qt::AlignCenter);
//.........这里部分代码省略.........
开发者ID:crowetic,项目名称:global-master,代码行数:101,代码来源:bitcoingui.cpp

示例10: createAction

void MainWindow::initGui(){
    this->setWindowTitle("Framework for empirical virtual agent studies");
    vGroup = new QGroupBox;
    vlayout = new QVBoxLayout;
    createAction();
    menu = new QMenuBar();
    fileMenu = new QMenu(tr("&Datei"), this);
    fileMenu->addAction(openAct);
    fileMenu->addAction(exitAct);
    menu->addMenu(fileMenu);
    extraMenu = new QMenu(tr("&Extras"), this);
    //extraMenu->addAction(loggerAct);
    menu->addMenu(extraMenu);
    logMenu = new QMenu(tr("&Logging"), this);
    extraMenu->addMenu(logMenu);
    logMenu->addAction(noLog);
    logMenu->addAction(logToConsole);
    logMenu->addAction(logToFile);

    QSize pixMapSize(80,50);
    QPixmap image(pixMapSize);

    developerPath = std::getenv("WBS_DEVELOPER_ROOT");

    image.load(developerPath + "/projects/StateMachine/image.bmp");
    //QPixmap image();
    label = new QLabel();
    label->setPixmap(image);
    hlayout = new QHBoxLayout();

    agentAdapterLabel = new QLabel("Select Agent Adapter");
    agentAdapterCombo = new QComboBox;
    agentAdapterCombo->setEnabled(false);
    agentAdaperBox = new QGroupBox(tr("Select Agent Adapter"));
    agentAdapterLayout = new QVBoxLayout;
    agentAdapterLayout->addWidget(agentAdapterCombo);
    startAgent = new QCheckBox("Start the agent");
    startAgent->setEnabled(false);
    agentAdapterLayout->addWidget(startAgent);
    agentAdaperBox->setLayout(agentAdapterLayout);

    MainWindow::firstUseBox = new QCheckBox("Nehmen Sie erste mal teil?");
    MainWindow::loadExistingProfile = new QPushButton("Profil laden");
    MainWindow::createSm = new QPushButton("execute state machine");
    MainWindow::loadSm = new QPushButton("load state machine");
    MainWindow::loadDataFile = new QPushButton("load Datafile");
    MainWindow::loadUtteranceFile = new QPushButton("load utterance file");

    loadLayout = new QVBoxLayout;
    loadBox = new QGroupBox(tr("Load Files"));
    loadLayout->addWidget(loadSm);
    //vlayout->addWidget(firstUseBox);
    firstUseBox->setEnabled(false);
    loadLayout->addWidget(loadUtteranceFile);
    loadUtteranceFile->setEnabled(false);
    loadLayout->addWidget(loadDataFile);
    loadBox->setLayout(loadLayout);
    vlayout->addWidget(loadBox);
    vlayout->addWidget(agentAdaperBox);

    startLayout = new QVBoxLayout;
    startLayout->addWidget(createSm);
    startBox = new QGroupBox(tr("Start StateMachine"));
    startBox->setLayout(startLayout);
    vlayout->addWidget(startBox);
    vlayout->addSpacing(30);
    //TODO:for testing onlay
    //vlayout->addLayout(testLayout);
    vlayout->addWidget(quit);
    createSm->setEnabled(false);
    loadDataFile->setEnabled(false);
    hlayout->addWidget(label);
    hlayout->addLayout(vlayout);
    vGroup->setLayout(hlayout);

    setCentralWidget(vGroup);
    this->show();
}
开发者ID:OlliD,项目名称:StateMachine,代码行数:78,代码来源:mainwindow.cpp

示例11: QMainWindow


//.........这里部分代码省略.........
      Awl::PitchLabel* pl = new Awl::PitchLabel();
      pl->setFrameStyle(QFrame::NoFrame | QFrame::Plain);
      tb->addWidget(pl);

      tb->addSeparator();
      tb->addWidget(new QLabel(tr("Velocity:")));
      veloType = new QComboBox;
      veloType->addItem(tr("offset"), MScore::OFFSET_VAL);
      veloType->addItem(tr("user"),   MScore::USER_VAL);
      tb->addWidget(veloType);

      velocity = new QSpinBox;
      velocity->setRange(-1, 127);
      velocity->setSpecialValueText("--");
      velocity->setReadOnly(true);
      tb->addWidget(velocity);

      tb->addWidget(new QLabel(tr("Pitch:")));
      pitch = new Awl::PitchEdit;
      pitch->setReadOnly(true);
      tb->addWidget(pitch);

      //-------------
      qreal xmag = .1;
      ruler = new Ruler;
      ruler->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
      ruler->setFixedHeight(rulerHeight);

      ruler->setMag(xmag, 1.0);

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

      gv  = new PianoView;
      gv->scale(xmag, 1.0);
      gv->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
      gv->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

      hsb = new QScrollBar(Qt::Horizontal);
      connect(gv->horizontalScrollBar(), SIGNAL(rangeChanged(int,int)),
         SLOT(rangeChanged(int,int)));

      // layout
      QHBoxLayout* hbox = new QHBoxLayout;
      hbox->setSpacing(0);
      hbox->addWidget(piano);
      hbox->addWidget(gv);

      split = new QSplitter(Qt::Vertical);
      split->setFrameShape(QFrame::NoFrame);

      QWidget* split1 = new QWidget;      // piano - pianoview
      split1->setLayout(hbox);
      split->addWidget(split1);

      QGridLayout* layout = new QGridLayout;
      layout->setContentsMargins(0, 0, 0, 0);
      layout->setSpacing(0);
      layout->setColumnMinimumWidth(0, pianoWidth + 5);
      layout->addWidget(tb,    0, 0, 1, 2);
      layout->addWidget(ruler, 1, 1);
      layout->addWidget(split, 2, 0, 1, 2);
      layout->addWidget(hsb,   3, 1);

      mainWidget->setLayout(layout);
      setCentralWidget(mainWidget);

      connect(gv->verticalScrollBar(), SIGNAL(valueChanged(int)), piano, SLOT(setYpos(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(hsb,         SIGNAL(valueChanged(int)),  SLOT(setXpos(int)));
      connect(gv,          SIGNAL(xposChanged(int)),   SLOT(setXpos(int)));
      connect(gv->horizontalScrollBar(), SIGNAL(valueChanged(int)), SLOT(setXpos(int)));

      connect(ruler,       SIGNAL(locatorMoved(int, const Pos&)), SLOT(moveLocator(int, const Pos&)));
      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);

      QActionGroup* ag = new QActionGroup(this);
      QAction* a = new QAction(this);
      a->setData("delete");
      a->setShortcut(Qt::Key_Delete);
      ag->addAction(a);
      addActions(ag->actions());
      connect(ag, SIGNAL(triggered(QAction*)), SLOT(cmd(QAction*)));
      setXpos(0);
      }
开发者ID:33akash,项目名称:MuseScore,代码行数:101,代码来源:pianoroll.cpp

示例12: QuasarWindow

SequenceNumber::SequenceNumber(MainWindow* main)
    : QuasarWindow(main, "SequenceNumber")
{
    _helpSource = "seq_number.html";

    QFrame* frame = new QFrame(this);
    QScrollView* sv = new QScrollView(frame);
    _nums = new QButtonGroup(4, Horizontal, tr("Seq Numbers"), sv->viewport());

    new QLabel("Type", _nums);
    new QLabel("Minimum", _nums);
    new QLabel("Maximum", _nums);
    new QLabel("Next", _nums);

    addIdEdit(tr("Data Object:"), "data_object", "object_id");
    addIdEdit(tr("Journal Entry:"), "gltx", "Journal Entry");
    addIdEdit(tr("Ledger Transfer:"), "gltx", "Ledger Transfer");
    addIdEdit(tr("Card Adjustment:"), "gltx", "Card Adjustment");
    addIdEdit(tr("Customer Invoice:"), "gltx", "Customer Invoice");
    addIdEdit(tr("Customer Return:"), "gltx", "Customer Return");
    addIdEdit(tr("Customer Payment:"), "gltx", "Customer Payment");
    addIdEdit(tr("Customer Quote:"), "quote", "number");
    addIdEdit(tr("Vendor Invoice:"), "gltx", "Vendor Invoice");
    addIdEdit(tr("Vendor Claim:"), "gltx", "Vendor Claim");
    addIdEdit(tr("Purchase Order:"), "porder", "number");
    addIdEdit(tr("Packing Slip:"), "slip", "number");
    addIdEdit(tr("Nosale:"), "gltx", "Nosale");
    addIdEdit(tr("Payout:"), "gltx", "Payout");
    addIdEdit(tr("Withdraw:"), "gltx", "Withdraw");
    addIdEdit(tr("Shift:"), "gltx", "Shift");
    addIdEdit(tr("Item Adjustment:"), "gltx", "Item Adjustment");
    addIdEdit(tr("Item Transfer:"), "gltx", "Item Transfer");
    addIdEdit(tr("Physical Count:"), "pcount", "number");
    addIdEdit(tr("Label Batch:"), "label_batch", "number");
    addIdEdit(tr("Price Batch:"), "price_batch", "number");
    addIdEdit(tr("Promo Batch:"), "promo_batch", "number");
    addIdEdit(tr("Company Number:"), "company", "number");
    addIdEdit(tr("Store Number:"), "store", "number");
    addIdEdit(tr("Station Number:"), "station", "number");
    addIdEdit(tr("Tender Count #:"), "tender_count", "number");
    addIdEdit(tr("Tender Menu #:"), "tender", "menu_num");

    QFrame* buttons = new QFrame(frame);
    QPushButton* ok = new QPushButton(tr("&OK"), buttons);
    QPushButton* quit = new QPushButton(tr("&Close"), buttons);

    connect(ok, SIGNAL(clicked()), SLOT(slotOk()));
    connect(quit, SIGNAL(clicked()), SLOT(close()));

    QGridLayout* buttonGrid = new QGridLayout(buttons);
    buttonGrid->setSpacing(3);
    buttonGrid->setMargin(3);
    buttonGrid->setColStretch(0, 1);
    buttonGrid->addWidget(ok, 0, 1);
    buttonGrid->addWidget(quit, 0, 2);

    _nums->resize(_nums->sizeHint());
    sv->setVScrollBarMode(QScrollView::AlwaysOn);
    sv->resizeContents(_nums->width() + 20, _nums->height());

    QGridLayout* grid = new QGridLayout(frame);
    grid->setSpacing(6);
    grid->setMargin(6);
    grid->setRowStretch(0, 1);
    grid->addWidget(sv, 0, 0);
    grid->addWidget(buttons, 1, 0);

    for (unsigned int i = 0; i < _ids.size(); ++i) {
	IdInfo& info = _ids[i];
	_quasar->db()->getSequence(info.seq);
	info.minNum->setFixed(info.seq.minNumber());
	info.maxNum->setFixed(info.seq.maxNumber());
	info.nextNum->setFixed(info.seq.nextNumber());
    }

    statusBar()->hide();
    setCentralWidget(frame);
    setCaption(tr("Sequence Numbers"));
    finalize();

    if (!allowed("View")) {
	QTimer::singleShot(50, this, SLOT(slotNotAllowed()));
	return;
    }
}
开发者ID:cwarden,项目名称:quasar,代码行数:85,代码来源:sequence_number.cpp

示例13: QPushButton

kd::kd()
{
    ready_to_die = false;

    /* Creating top-right area (Line input and button) */
    item_input = new QLineEdit;
    item_button = new QPushButton(tr("Add"));
    item_button->setDefault(true);
    bottom_h_layout = new QHBoxLayout;
    bottom_h_layout->addWidget(item_input);
    bottom_h_layout->addWidget(item_button);

    items_tree = new QTreeWidget;
    items_tree->setColumnCount(2);
    items_tree->setHeaderLabels(QStringList() << tr("Goods") << tr("Price") );

    added_items = new QTextBrowser;
    central_widget = new QSplitter;
    central_widget->addWidget(items_tree);
    central_widget->addWidget(added_items);
    central_widget->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);

    /* Create right side (top area, suggest label and list of added items) */
    item_suggest = new QLabel;
    right_v_layout = new QVBoxLayout;
    right_v_layout->addWidget(item_suggest);
    right_v_layout->addWidget(central_widget);
    right_v_layout->addLayout(bottom_h_layout);
    right_widget = new QWidget;
    right_widget->setLayout(right_v_layout);

    setCentralWidget( right_widget );
    item_input->setFocus();

    /* Restore window settings */
    app_settings = new QSettings(QSettings::IniFormat, QSettings::UserScope, "Stinky", "Celtic House Menu");
    app_settings->beginGroup("MainWindow");
    resize(app_settings->value("Size", QSize(400, 400)).toSize());
    move(app_settings->value("Position", QPoint(200, 200)).toPoint());
    central_widget->restoreState( app_settings->value("Splitter").toByteArray() );
    app_settings->endGroup();

    menu_file = new QSettings(QSettings::IniFormat, QSettings::SystemScope, "Stinky", "Celtic House Menu");
    qDebug() << "Menu in " << menu_file->fileName();
    cards = new QSettings(QSettings::IniFormat, QSettings::SystemScope, "Stinky", "cards");
    qDebug() << "Menu in " << cards->fileName();
    // Cards debug
    QStringList ckeys = cards->allKeys();
    for(int i = 0; i < ckeys.size(); ++i) {
        qDebug() << "Value:" << ckeys.at(i) << " = " << QString::fromUtf8( cards->value( ckeys.at(i), "Ы" ).toString().toAscii() );
    }

    QString logs_dir = menu_file->value("Settings/LogsDir", "").toString();
    if(logs_dir.length() > 1)
        logger = new Logger(logs_dir);
    else
        logger = new Logger;
    QString errmsg;
    if(logger->getError(errmsg) != QFile::NoError)
    {
        QMessageBox msgBox;
        msgBox.setIcon(QMessageBox::Critical);
        msgBox.setText(tr("Can not open log file."));
        msgBox.setInformativeText(errmsg);
        msgBox.exec();
        ready_to_die = true;
        return;
    }

    // readMenu
    QString tmpstr = QString("root");
    readMenu(*items_tree->invisibleRootItem(), tmpstr, tmpstr);
    tmpstr = QString("launcher");
    QTreeWidgetItem *tmpitem = new QTreeWidgetItem;

    QBrush *red = new QBrush(Qt::red);
    tmpitem->setForeground(0, *red);
    readMenu(*tmpitem, tmpstr, tmpstr);
    tmpitem->setText( 2, "/" );
    items_tree->addTopLevelItem(tmpitem);
    /*End read menu*/

    items_tree->expandAll();
    items_tree->resizeColumnToContents(1);
    items_tree->resizeColumnToContents(0);
    items_tree->collapseAll();
    totalprice = 0;

    QAction* a_quit = new QAction(this);
    QAction* a_rotate = new QAction(this);
    a_quit->setText( "Quit" );
    a_rotate->setText( "Rotate" );

    QMenu *filemenu = menuBar()->addMenu( "File" );
    filemenu->addAction( a_quit );
    filemenu->addAction( a_rotate );
    //status_bar = new QStatusBar(central_widget);
    //statusBar();
    updateCurrentTotal();

//.........这里部分代码省略.........
开发者ID:stinky-nnov,项目名称:kd,代码行数:101,代码来源:kd.cpp

示例14: m_dongle

MainWindow::MainWindow(const QUrl& url) : m_dongle(new mobot_t)
{
    progress = 0;

    QFile file;
    file.setFileName(":/jquery.min.js");
    file.open(QIODevice::ReadOnly);
    jQuery = file.readAll();
    jQuery.append("\nvar qt = { 'jQuery': jQuery.noConflict(true) };");
    file.close();
//! [1]

    QNetworkProxyFactory::setUseSystemConfiguration(true);

    m_interface = new JsInterface(this);
//! [2]
    view = new QWebView(this);
    view->load(url);
    connect(view, SIGNAL(loadFinished(bool)), SLOT(adjustLocation()));
    connect(view, SIGNAL(titleChanged(QString)), SLOT(adjustTitle()));
    connect(view, SIGNAL(loadProgress(int)), SLOT(setProgress(int)));
    connect(view, SIGNAL(loadFinished(bool)), SLOT(finishLoading(bool)));
    connect(view->page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()),
            this, SLOT(populateJavaScriptWindowObject()));

    locationEdit = new QLineEdit(this);
    locationEdit->setSizePolicy(QSizePolicy::Expanding, locationEdit->sizePolicy().verticalPolicy());
    connect(locationEdit, SIGNAL(returnPressed()), SLOT(changeLocation()));

    QToolBar *toolBar = addToolBar(tr("Navigation"));
    toolBar->addAction(view->pageAction(QWebPage::Back));
    toolBar->addAction(view->pageAction(QWebPage::Forward));
    toolBar->addAction(view->pageAction(QWebPage::Reload));
    toolBar->addAction(view->pageAction(QWebPage::Stop));
    toolBar->addWidget(locationEdit);
//! [2]

    QMenu *viewMenu = menuBar()->addMenu(tr("&View"));
    QAction* viewSourceAction = new QAction("Page Source", this);
    connect(viewSourceAction, SIGNAL(triggered()), SLOT(viewSource()));
    viewMenu->addAction(viewSourceAction);

//! [3]
    QMenu *effectMenu = menuBar()->addMenu(tr("&Effect"));
    effectMenu->addAction("Highlight all links", this, SLOT(highlightAllLinks()));

    rotateAction = new QAction(this);
    rotateAction->setIcon(style()->standardIcon(QStyle::SP_FileDialogDetailedView));
    rotateAction->setCheckable(true);
    rotateAction->setText(tr("Turn images upside down"));
    connect(rotateAction, SIGNAL(toggled(bool)), this, SLOT(rotateImages(bool)));
    effectMenu->addAction(rotateAction);

    QMenu *toolsMenu = menuBar()->addMenu(tr("&Tools"));
    toolsMenu->addAction(tr("Remove GIF images"), this, SLOT(removeGifImages()));
    toolsMenu->addAction(tr("Remove all inline frames"), this, SLOT(removeInlineFrames()));
    toolsMenu->addAction(tr("Remove all object elements"), this, SLOT(removeObjectElements()));
    toolsMenu->addAction(tr("Remove all embedded elements"), this, SLOT(removeEmbeddedElements()));

    setCentralWidget(view);
    setUnifiedTitleAndToolBarOnMac(true);

    baroboInit();
    
    qDebug() << "App path : " << qApp->applicationDirPath();
}
开发者ID:aruggles,项目名称:BaroboLabHack,代码行数:66,代码来源:mainwindow.cpp

示例15: QMainWindow

MainWindow::MainWindow(QAction* actionQuit, QAction* actionNewTab, QAction* actionFullscreen, QAction* actionLoadSession, QAction* actionSaveSession, QWidget* parent)
    : QMainWindow(parent),
    ui(new Ui::MainWindow),
    fetcher(new Fetcher),
    local(new LocalFetcher),
    source(IMAGE_SOURCE_UNKNOWN)
{
    ui->setupUi(this);

    QStringList  sources;
    sources.append("Google");
    sources.append("Local file");
//    sources.append("Picsearch");
    ui->cbSource->addItems(sources);
    ui->cbSource->setCurrentIndex(IMAGE_SOURCE_GOOGLE);

    fetcher->hide();
    local->hide();

    ui->menuFile->addAction(actionNewTab);
    ui->menuFile->addAction(actionLoadSession);
    ui->menuFile->addAction(actionSaveSession);
    ui->menuFile->addAction(actionQuit);
    ui->menuView->insertAction(ui->actionResetTransforms,actionFullscreen);

    ui->tbFullScreen->setDefaultAction(actionFullscreen);
    ui->tbNewTab->setDefaultAction(actionNewTab);
    ui->tbResetTransform->setDefaultAction(ui->actionResetTransforms);
    ui->tbSave->setDefaultAction(actionSaveSession);

    ui->glTools->addWidget(fetcher,0,6,2,1);
    ui->glTools->addWidget(local,0,6,2,1);

    updateSource();

    connect(ui->cbSource,SIGNAL(currentIndexChanged(int)),this,SLOT(updateSource()));

    ui->actionViewOnlyMode->setShortcut(Qt::Key_Tab);
    QList<QKeySequence> keys;
    keys << Qt::Key_Delete << Qt::Key_Backspace;
    ui->actionDeleteSelected->setShortcuts(keys);
    // These are necessary if the actions are to remain accessible when the menubar is hidden:
    this->addAction(ui->actionViewOnlyMode);
    this->addAction(ui->actionResetTransforms);
    this->addAction(ui->actionZoomToFit);
    this->addAction(ui->actionIntroduction);
    this->addAction(ui->actionTips);
    this->addAction(ui->actionOpenDirectory);
    this->addAction(ui->actionOpenFile);

    this->addAction(ui->actionDeleteSelected);
    this->addAction(ui->actionUncropSelected);
    this->addAction(ui->actionCentreInView);
    this->addAction(ui->actionResetRotation);
    this->addAction(ui->actionResetScale);
    this->addAction(ui->actionScaleToFit);

    this->addAction(actionFullscreen);
    this->addAction(actionLoadSession);
    this->addAction(actionSaveSession);
    this->addAction(actionNewTab);
    this->addAction(actionQuit);

    connect(ui->actionIntroduction,SIGNAL(triggered()),this,SLOT(showHelp()));
    connect(ui->actionTips,SIGNAL(triggered()),this,SLOT(showTips()));
    connect(ui->actionViewOnlyMode,SIGNAL(triggered(bool)),this,SLOT(enterViewOnlyMode(bool)));
    connect(ui->actionPreferences,SIGNAL(triggered()),this,SLOT(showPreferences()));

    connect(fetcher,SIGNAL(queryChanged(QString)),this,SIGNAL(queryChanged(QString)));
    connect(fetcher,SIGNAL(imageResult(QUrl,QUrl,bool)),this,SLOT(processImageResult(QUrl,QUrl,bool)));
    connect(local,SIGNAL(imageResult(QUrl,QUrl,bool)),this,SLOT(processImageResult(QUrl,QUrl,bool)));
    connect(local,SIGNAL(queryChanged(QString)),this,SIGNAL(queryChanged(QString)));

    initBlacklistDocker();
    initInfoDocker();

    initView(parent);
    dlDir = QString(DEFAULT_DOWNLOAD_DIRECTORY);
    dlMgr = new QNetworkAccessManager(this);


    connect(ui->actionResetTransforms,SIGNAL(triggered()),gvMain,SLOT(resetTransforms()));
    connect(ui->actionZoomToFit,SIGNAL(triggered()),gvMain,SLOT(zoomToFit()));
    connect(ui->actionOpenDirectory,SIGNAL(triggered()),local,SLOT(selectDirectory()));
    connect(ui->actionOpenFile,SIGNAL(triggered()),local,SLOT(selectFile()));

    connect(ui->actionDeleteSelected,SIGNAL(triggered()),gsMain,SLOT(deleteSelected()));
    connect(ui->actionUncropSelected,SIGNAL(triggered()),gsMain,SLOT(uncropSelected()));
    connect(ui->actionCentreInView,SIGNAL(triggered()),gsMain,SLOT(centreSelection()));
    connect(ui->actionResetRotation,SIGNAL(triggered()),gsMain,SLOT(resetSelectionRotation()));
    connect(ui->actionResetScale,SIGNAL(triggered()),gsMain,SLOT(resetSelectionScale()));
    connect(ui->actionScaleToFit,SIGNAL(triggered()),this,SLOT(scaleSelectedToFit()));

    ui->verticalLayout->removeWidget(ui->toolWidget);
    ui->toolBar->addWidget(ui->toolWidget);
    setCentralWidget(gvMain);
    ui->thumbBar->addWidget(gvCarousel);

    ui->statusBar->addWidget(fetcher->getStatusText(),0);
    ui->statusBar->addWidget(fetcher->getProgressBar(),1);
//.........这里部分代码省略.........
开发者ID:Thra11,项目名称:RefImage,代码行数:101,代码来源:mainwindow.cpp


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