本文整理汇总了C++中setWindowIcon函数的典型用法代码示例。如果您正苦于以下问题:C++ setWindowIcon函数的具体用法?C++ setWindowIcon怎么用?C++ setWindowIcon使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setWindowIcon函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: interpreter_loadPixmap
void screen::setWindowIcon2()
{
QPixmap p = interpreter_loadPixmap("VIEW_KONSOLE.png");
setWindowIcon(QIcon(p));
}
示例2: QTextEdit
MainWindow::MainWindow()
{
outputLog = new QTextEdit(this);
outputLog->setReadOnly(true);
outputLog->append("MTG log \n-------\n");
//to be created a central widget
//setCentralWidget(new QWidget());
setCentralWidget(outputLog);
setWindowIcon(QIcon(":/images/MTG.png"));
//creating the menu titles
fileMenu = menuBar()->addMenu(tr("&File"));
//editMenu = menuBar()->addMenu(tr("&Edit"));
analyzerMenu = menuBar()->addMenu(tr("Analyzer"));
DMmenu = menuBar()->addMenu(tr("DataManager"));
MMmenu = menuBar()->addMenu(tr("MaskManager"));
viewMenu = menuBar()->addMenu(tr("&View"));
menuBar()->addSeparator();
helpMenu = menuBar()->addMenu(tr("&Help"));
// creating stuff
//warning: take care of the order you call these functions
createDockWindows();
createActions();
createMenus();
createToolBars();
createStatusBar();
QFile file(":/styles.qss");
file.open(QFile::ReadOnly);
QString styleSheet = QLatin1String(file.readAll());
qApp->setStyleSheet(styleSheet);
setWindowTitle(tr("Matrix Tool GUI"));
setIconSize(QSize(35,35));
desktop = qApp->desktop();
connect(desktop, SIGNAL(resized(int)), this, SLOT(centerMainWindowGeometry()));
//connect(dataManager, SIGNAL(plotHisto(QPair<matrixData*, QString>)), this, SLOT(raisePlotDock()));
connect(dataManager, SIGNAL(plotHisto(QPair<matrixData*, QString>)), plotWidget, SLOT(histoMatrix(QPair<matrixData*, QString>)));
//connect(dataManager, SIGNAL(inspectMatrixData(QPair<matrixData*, QString>)), this, SLOT(raiseEVDock()));
connect(dataManager, SIGNAL(inspectMatrixData(QPair<matrixData*, QString>)),eventViewer, SLOT(attachMatrixData(QPair<matrixData*, QString>)));
//raise the involved dock when action is triggered
connect(newDataSetAct, SIGNAL(triggered()), this, SLOT(raiseDMDock()));
connect(rmDataSetAct, SIGNAL(triggered()), this, SLOT(raiseDMDock()));
connect(rmAllDataSetAct, SIGNAL(triggered()), this, SLOT(raiseDMDock()));
connect(plotDataSetAct, SIGNAL(triggered()), this, SLOT(raiseDMDock()));
connect(plotDataSetAct, SIGNAL(triggered()), this, SLOT(raisePlotDock()));
connect(saveDataSetAct, SIGNAL(triggered()), this, SLOT(raiseDMDock()));
connect(inspectEventAct, SIGNAL(triggered()), this, SLOT(raiseDMDock()));
connect(inspectEventAct, SIGNAL(triggered()), this, SLOT(raiseEVDock()));
connect(renameDataSetAct, SIGNAL(triggered()), this, SLOT(raiseDMDock()));
//
connect(newMaskSetAct, SIGNAL(triggered()), this, SLOT(raiseMMDock()));
connect(printMaskAct, SIGNAL(triggered()), this, SLOT(raiseMMDock()));
connect(rmMaskSetAct, SIGNAL(triggered()), this, SLOT(raiseMMDock()));
connect(renameMaskSetAct, SIGNAL(triggered()), this, SLOT(raiseMMDock()));
connect(editMaskAct, SIGNAL(triggered()), this, SLOT(raiseMMDock()));
//raise the involved dock when made visible
connect(DMviewAct, SIGNAL(triggered()), this, SLOT(raiseDMDock()));
connect(MMviewAct, SIGNAL(triggered()), this, SLOT(raiseMMDock()));
connect(plotViewAct, SIGNAL(triggered()), this, SLOT(raisePlotDock()));
connect(EVviewAct, SIGNAL(triggered()), this, SLOT(raiseEVDock()));
//connect the log output signals
connect(dataManager, SIGNAL(outputLog(QString)), outputLog, SLOT(append(QString)));
connect(maskManager, SIGNAL(outputLog(QString)), outputLog, SLOT(append(QString)));
connect(plotWidget, SIGNAL(outputLog(QString)), outputLog, SLOT(append(QString)));
connect(eventViewer, SIGNAL(outputLog(QString)), outputLog, SLOT(append(QString)));
setUnifiedTitleAndToolBarOnMac(true);
}
示例3: QMainWindow
BitcoinGUI::BitcoinGUI(QWidget *parent):
QMainWindow(parent),
clientModel(0),
walletModel(0),
encryptWalletAction(0),
changePassphraseAction(0),
lockWalletToggleAction(0),
aboutQtAction(0),
trayIcon(0),
notificator(0),
rpcConsole(0)
{
resize(850, 550);
setWindowTitle(tr("SGcoin") + " - " + 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->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks);
frameBlocksLayout->setContentsMargins(3,0,3,0);
frameBlocksLayout->setSpacing(3);
labelEncryptionIcon = new QLabel();
labelMintingIcon = new QLabel();
labelConnectionsIcon = new QLabel();
labelBlocksIcon = new QLabel();
frameBlocksLayout->addStretch();
frameBlocksLayout->addWidget(labelEncryptionIcon);
frameBlocksLayout->addStretch();
frameBlocksLayout->addWidget(labelMintingIcon);
frameBlocksLayout->addStretch();
frameBlocksLayout->addWidget(labelConnectionsIcon);
frameBlocksLayout->addStretch();
frameBlocksLayout->addWidget(labelBlocksIcon);
frameBlocksLayout->addStretch();
// Set minting pixmap
labelMintingIcon->setPixmap(QIcon(":/icons/minting").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
labelMintingIcon->setEnabled(false);
// Add timer to update minting icon
QTimer *timerMintingIcon = new QTimer(labelMintingIcon);
timerMintingIcon->start(MODEL_UPDATE_DELAY);
connect(timerMintingIcon, SIGNAL(timeout()), this, SLOT(updateMintingIcon()));
// Add timer to update minting weights
QTimer *timerMintingWeights = new QTimer(labelMintingIcon);
timerMintingWeights->start(30 * 1000);
connect(timerMintingWeights, SIGNAL(timeout()), this, SLOT(updateMintingWeights()));
// Set initial values for user and network weights
nWeight, nNetworkWeight = 0;
// Progress bar and label for blocks download
//.........这里部分代码省略.........
示例4: setWindowIcon
void EditorMainWindow::SetupUI(QMainWindow *MainWindow) {
setWindowIcon(*QtConfig::GetIcon("colorwheel.png"));
MainWindow->setWindowTitle("Sound Engine v0.2.3");
MainWindow->resize(1280, 720);
MainWindow->setDockOptions(QMainWindow::AnimatedDocks |
QMainWindow::AllowNestedDocks |
QMainWindow::AllowTabbedDocks);
MainWindow->setTabPosition(Qt::AllDockWidgetAreas, QTabWidget::TabPosition::North);
// ************************************************************************
// Load styling
ReloadStyleSheets();
// ************************************************************************
// File Picker
auto *picker = new FilePicker();
picker->setNameFilter("*.xml");
GUI::Set(QT_INSTACE::FILE_PICKER, (void*) picker);
// ************************************************************************
// Menu Bar
QMenuBar *menuBar = new QMenuBar(MainWindow);
menuBar->setObjectName(QStringLiteral("menuBar"));
menuBar->setGeometry(QRect(0, 0, 1051, 21));
MainWindow->setMenuBar(menuBar);
// Menu Entry
{
QMenu *menuEngine = new QMenu(menuBar);
menuEngine->setObjectName(QStringLiteral("menuEngine"));
menuEngine->setTitle("File");
menuBar->addAction(menuEngine->menuAction());
{
QAction *action = new QAction(MainWindow);
action->setText("Exit");
action->setIcon(*QtConfig::GetIcon("power.png"));
menuEngine->addAction(action);
QObject::connect(action, &QAction::triggered, this, &EditorMainWindow::close);
}
{
QAction *action = new QAction(MainWindow);
action->setText("Save As...");
action->setIcon(*QtConfig::GetIcon("memorycard.png"));
menuEngine->addAction(action);
QObject::connect(action, &QAction::triggered, this, [picker]() {
picker->OpenForSave();
});
QObject::connect(picker, &QFileDialog::fileSelected, this, [picker] (const QString & file) {
if (picker->IsSaving()) {
CSoundEditor::GetScene()->SaveSceneAs(file.toStdString().c_str());
}
});
}
}
// Menu Entry
{
QMenu *menu = new QMenu(menuBar);
menu->setTitle("Scene");
menuBar->addAction(menu->menuAction());
// Submenu buttons
QAction *action = new QAction(MainWindow);
action->setText("Clear Scene");
action->setIcon(*QtConfig::GetIcon("denied.png"));
menu->addAction(action);
QObject::connect(action, &QAction::triggered, this, []() {
CSoundEditor::GetScene()->Clear();
GUI::Get<SceneWindow>(QT_INSTACE::SCENE_EDITOR)->Clear();
});
}
// Menu Entry
{
QMenu *menu = new QMenu(menuBar);
menu->setTitle("Tools");
menuBar->addAction(menu->menuAction());
// Submenu buttons
{
QAction *action = new QAction(MainWindow);
action->setText("Reload StyleSheets");
action->setIcon(*QtConfig::GetIcon("cmyk.png"));
menu->addAction(action);
QObject::connect(action, &QAction::triggered, this, &EditorMainWindow::ReloadStyleSheets);
}
//.........这里部分代码省略.........
示例5: QMainWindow
BitcoinGUI::BitcoinGUI(const NetworkStyle &networkStyle, QWidget *parent) :
QMainWindow(parent),
clientModel(0),
walletFrame(0),
unitDisplayControl(0),
labelEncryptionIcon(0),
labelConnectionsIcon(0),
labelBlocksIcon(0),
progressBarLabel(0),
progressBar(0),
progressDialog(0),
appMenuBar(0),
overviewAction(0),
historyAction(0),
quitAction(0),
sendCoinsAction(0),
sendCoinsMenuAction(0),
usedSendingAddressesAction(0),
usedReceivingAddressesAction(0),
signMessageAction(0),
verifyMessageAction(0),
aboutAction(0),
receiveCoinsAction(0),
receiveCoinsMenuAction(0),
optionsAction(0),
toggleHideAction(0),
encryptWalletAction(0),
backupWalletAction(0),
changePassphraseAction(0),
aboutQtAction(0),
openRPCConsoleAction(0),
openAction(0),
showHelpMessageAction(0),
trayIcon(0),
trayIconMenu(0),
notificator(0),
rpcConsole(0),
infoQueue(this),
prevBlocks(0),
spinnerFrame(0)
{
GUIUtil::restoreWindowGeometry("nWindow", QSize(850, 550), this);
QString windowTitle = tr("Bitcoin XT") + " - ";
#ifdef ENABLE_WALLET
/* if compiled with wallet support, -disablewallet can still disable the wallet */
enableWallet = !GetBoolArg("-disablewallet", false);
#else
enableWallet = false;
#endif // ENABLE_WALLET
if(enableWallet)
{
windowTitle += tr("Wallet");
} else {
windowTitle += tr("Node");
}
windowTitle += " " + networkStyle.getTitleAddText();
#ifndef Q_OS_MAC
QApplication::setWindowIcon(networkStyle.getTrayAndWindowIcon());
setWindowIcon(networkStyle.getTrayAndWindowIcon());
#else
// TODO we convert a QImage to a pixmap, to an icon and in the MacDockIconHandler we
// do it in the opposite directoin just go arrive at a QImage again.
// A mac hacker should fix that so we just pass a QImage (networkStyle::getAppIcon()).
MacDockIconHandler::instance()->setIcon(networkStyle.getTrayAndWindowIcon());
#endif
setWindowTitle(windowTitle);
#if defined(Q_OS_MAC) && QT_VERSION < 0x050000
// This property is not implemented in Qt 5. Setting it has no effect.
// A replacement API (QtMacUnifiedToolBar) is available in QtMacExtras.
setUnifiedTitleAndToolBarOnMac(true);
#endif
rpcConsole = new RPCConsole(0);
#ifdef ENABLE_WALLET
if(enableWallet)
{
/** Create wallet frame and make it the central widget */
walletFrame = new WalletFrame(this);
setCentralWidget(walletFrame);
} else
#endif // ENABLE_WALLET
{
/* When compiled without wallet or -disablewallet is provided,
* the central widget is the rpc console.
*/
setCentralWidget(rpcConsole);
}
// Accept D&D of URIs
setAcceptDrops(true);
// Create actions for the toolbar, menu bar and tray/dock icon
// Needs walletFrame to be initialized
createActions();
// Create application menu bar
createMenuBar();
//.........这里部分代码省略.........
示例6: InviwoDockWidget
PythonEditorWidget::PythonEditorWidget(InviwoMainWindow* ivwwin, InviwoApplication* app)
: InviwoDockWidget(tr("Python Editor"), ivwwin)
, settings_("Inviwo", "Inviwo")
, infoTextColor_(153, 153, 153)
, errorTextColor_(255, 107, 107)
, runAction_(nullptr)
, script_()
, unsavedChanges_(false)
, app_(app)
, appendLog_(true)
{
setObjectName("PythonEditor");
settings_.beginGroup("PythonEditor");
QString lastFile = settings_.value("lastScript", "").toString();
appendLog_ = settings_.value("appendLog", appendLog_).toBool();
settings_.endGroup();
setVisible(false);
setWindowIcon(QIcon(":/icons/python.png"));
QMainWindow* mainWindow = new QMainWindow();
mainWindow->setContextMenuPolicy(Qt::NoContextMenu);
QToolBar* toolBar = new QToolBar();
mainWindow->addToolBar(toolBar);
toolBar->setFloatable(false);
toolBar->setMovable(false);
setWidget(mainWindow);
{
runAction_ = toolBar->addAction(QIcon(":/icons/python.png"), "Compile and Run");
runAction_->setShortcut(QKeySequence(tr("F5")));
runAction_->setShortcutContext(Qt::WidgetWithChildrenShortcut);
runAction_->setToolTip("Compile and Run Script");
mainWindow->addAction(runAction_);
connect(runAction_, &QAction::triggered, [this]() {run(); });
}
{
auto action = toolBar->addAction(QIcon(":/icons/new.png"), tr("&New Script"));
action->setShortcut(QKeySequence::New);
action->setShortcutContext(Qt::WidgetWithChildrenShortcut);
action->setToolTip("New Script");
mainWindow->addAction(action);
connect(action, &QAction::triggered, [this](){setDefaultText();});
}
{
auto action = toolBar->addAction(QIcon(":/icons/open.png"), tr("&Open Script"));
action->setShortcut(QKeySequence::Open);
action->setShortcutContext(Qt::WidgetWithChildrenShortcut);
action->setToolTip("Open Script");
mainWindow->addAction(action);
connect(action, &QAction::triggered, [this](){open();});
}
{
auto action = toolBar->addAction(QIcon(":/icons/save.png"), tr("&Save Script"));
action->setShortcut(QKeySequence::Save);
action->setShortcutContext(Qt::WidgetWithChildrenShortcut);
action->setToolTip("Save Script");
mainWindow->addAction(action);
connect(action, &QAction::triggered, [this](){save();});
}
{
auto action = toolBar->addAction(QIcon(":/icons/saveas.png"), tr("&Save Script As..."));
action->setShortcut(QKeySequence::SaveAs);
action->setShortcutContext(Qt::WidgetWithChildrenShortcut);
action->setToolTip("Save Script As...");
mainWindow->addAction(action);
connect(action, &QAction::triggered, [this](){saveAs();});
}
{
QIcon icon;
icon.addFile(":/icons/log-append.png", QSize(), QIcon::Normal, QIcon::On);
icon.addFile(":/icons/log-clearonrun.png", QSize(), QIcon::Normal, QIcon::Off);
QString str = (appendLog_ ? "Append Log" : "Clear Log on Run");
auto action = toolBar->addAction(icon, str);
action->setShortcut(Qt::ControlModifier + Qt::Key_E);
action->setShortcutContext(Qt::WidgetWithChildrenShortcut);
action->setCheckable(true);
action->setChecked(appendLog_);
action->setToolTip(appendLog_ ? "Append Log" : "Clear Log on Run");
mainWindow->addAction(action);
connect(action, &QAction::toggled, [this, action](bool toggle) {
appendLog_ = toggle;
// update tooltip and menu entry
QString tglstr = (toggle ? "Append Log" : "Clear Log on Run");
action->setText(tglstr);
action->setToolTip(tglstr);
// update settings
settings_.beginGroup("PythonEditor");
settings_.setValue("appendLog", appendLog_);
settings_.endGroup();
});
}
{
auto action = toolBar->addAction(QIcon(":/icons/log-clear.png"), "Clear Log Output");
action->setShortcut(Qt::ControlModifier + Qt::Key_E);
action->setShortcutContext(Qt::WidgetWithChildrenShortcut);
action->setToolTip("Clear Log Output");
mainWindow->addAction(action);
//.........这里部分代码省略.........
示例7: QGraphicsView
StelMainView::StelMainView(QWidget* parent)
: QGraphicsView(parent), guiItem(NULL), gui(NULL),
flagInvertScreenShotColors(false),
flagOverwriteScreenshots(false),
screenShotPrefix("stellarium-"),
screenShotDir(""),
cursorTimeout(-1.f), flagCursorTimeout(false), minFpsTimer(NULL), maxfps(10000.f)
{
StelApp::initStatic();
// Can't create 2 StelMainView instances
Q_ASSERT(!singleton);
singleton = this;
setWindowIcon(QIcon(":/mainWindow/icon.bmp"));
initTitleI18n();
setObjectName("Mainview");
// Allows for precise FPS control
setViewportUpdateMode(QGraphicsView::NoViewportUpdate);
setFrameShape(QFrame::NoFrame);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setFocusPolicy(Qt::StrongFocus);
connect(this, SIGNAL(screenshotRequested()), this, SLOT(doScreenshot()));
lastEventTimeSec = 0;
#if STEL_USE_NEW_OPENGL_WIDGETS
// Primary test for OpenGL existence
if (QSurfaceFormat::defaultFormat().majorVersion() < 2)
{
qWarning() << "No OpenGL 2 support on this system. Aborting.";
QMessageBox::critical(0, "Stellarium", q_("No OpenGL 2 found on this system. Please upgrade hardware or use MESA or an older version."), QMessageBox::Abort, QMessageBox::Abort);
exit(0);
}
//QSurfaceFormat format();
//// TBD: What options shall be default?
//QSurfaceFormat::setDefaultFormat(format);
////QOpenGLContext* context=new QOpenGLContext::create();
glWidget = new StelQOpenGLWidget(this);
//glWidget->setFormat(format);
#else
// Primary test for OpenGL existence
if (QGLFormat::openGLVersionFlags() < QGLFormat::OpenGL_Version_2_1)
{
qWarning() << "No OpenGL 2.1 support on this system. Aborting.";
QMessageBox::critical(0, "Stellarium", q_("No OpenGL 2 found on this system. Please upgrade hardware or use MESA or an older version."), QMessageBox::Abort, QMessageBox::Abort);
exit(1);
}
// Create an openGL viewport
QGLFormat glFormat(QGL::StencilBuffer | QGL::DepthBuffer | QGL::DoubleBuffer);
// Even if setting a version here, it is ignored in StelQGLWidget()!
// TBD: Maybe this must make a differentiation between OpenGL and OpenGL ES!
// glFormat.setVersion(2, 1);
QGLContext* context=new QGLContext(glFormat);
if (context->format() != glFormat)
{
qWarning() << "Cannot provide OpenGL context. Apparently insufficient OpenGL resources on this system.";
QMessageBox::critical(0, "Stellarium", q_("Cannot acquire necessary OpenGL resources."), QMessageBox::Abort, QMessageBox::Abort);
exit(1);
}
glWidget = new StelQGLWidget(context, this);
// This does not return the version number set previously!
// qDebug() << "glWidget.context.format.version, result:" << glWidget->context()->format().majorVersion() << "." << glWidget->context()->format().minorVersion();
#endif
setViewport(glWidget);
setScene(new QGraphicsScene(this));
scene()->setItemIndexMethod(QGraphicsScene::NoIndex);
rootItem = new QGraphicsWidget();
rootItem->setFocusPolicy(Qt::NoFocus);
// Workaround (see Bug #940638) Although we have already explicitly set
// LC_NUMERIC to "C" in main.cpp there seems to be a bug in OpenGL where
// it will silently reset LC_NUMERIC to the value of LC_ALL during OpenGL
// initialization. This has been observed on Ubuntu 11.10 under certain
// circumstances, so here we set it again just to be on the safe side.
setlocale(LC_NUMERIC, "C");
// End workaround
}
示例8: FramelessWizard
VpnWizard::VpnWizard(QWidget * parent)
: FramelessWizard(parent)
{
addPage(new CStartPage);
addPage(new GeneralPage);
addPage(new RemotePage);
addPage(new CertPage);
addPage(new AdvPage);
addPage(new CEndPage);
//this->button(QWizard::WizardButton::BackButton)->setIcon(QIcon(":/data/images/back_small.png"));
//this->button(QWizard::WizardButton::NextButton)->setIcon(QIcon(":/data/images/next_small.png"));
auto geom = this->geometry();
geom.setHeight(460);
geom.setWidth(501);
QSize size = geom.size();
//
int h = size.height();
int w = size.width();
//
size.setHeight(qFloor(h * windowsDpiScale()));
size.setWidth(qFloor(w * windowsDpiScale()));
setFixedWidth(size.width());
setFixedHeight(size.height());
//
resize(size);
QPixmap pixmap(":/data/images/banner_wiz.png");
pixmap = pixmap.scaledToWidth(size.width(), Qt::TransformationMode::SmoothTransformation);
setPixmap(QWizard::BannerPixmap, pixmap);
//page(0)->setContentsMargins(0, 20, 0, 0);
//page(1)->setContentsMargins(0, 20, 0, 0);
//page(2)->setContentsMargins(0, 20, 0, 0);
//page(3)->setContentsMargins(0, 20, 0, 0);
//page(4)->setContentsMargins(0, 20, 0, 0);
setWindowIcon(QIcon(":/data/images/logo.png"));
setWindowTitle(QObject::tr("Create a new SSL VPN connection"));
setWindowFlags(Qt::WindowCloseButtonHint);
setModal(true);
this->setWindowFlags(Qt::WindowCloseButtonHint | Qt::FramelessWindowHint);
DWORD style = GetWindowLong((HWND)winId(), GWL_STYLE);
SetWindowLong((HWND)winId(), GWL_STYLE, style);
setWizardStyle(ModernStyle);
//this->button(QWizard::WizardButton::NextButton)->setLayoutDirection(Qt::RightToLeft);
this->setButtonText(QWizard::WizardButton::NextButton, QObject::tr("Next"));
this->setButtonText(QWizard::WizardButton::BackButton, QObject::tr("Back"));
this->setButtonText(QWizard::WizardButton::CancelButton, QObject::tr("Cancel"));
this->setButtonText(QWizard::WizardButton::FinishButton, QObject::tr("Finish"));
setStyleSheet("QPushButton:hover {background-color: rgb(195, 195, 195);}\nQPushButton {;text-align:center; \npadding-left: 3px;\n padding-top: 3px; padding-right: 3px;\n padding-bottom: 3px;}");
this->setupFrameless();
}
示例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),
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
//.........这里部分代码省略.........
示例10: QDialog
SearchDialog::SearchDialog(QWidget *parent): QDialog(parent)
{
// Title
setWindowTitle(tr("Search and replace"));
setWindowIcon(QIcon(QString(ICON_PATH) + "/search.png"));
// Layout
QVBoxLayout *vlayout = new QVBoxLayout();
setLayout(vlayout);
// Search
QGroupBox *searchGroup = new QGroupBox(this);
searchGroup->setTitle(tr("Search"));
vlayout->addWidget(searchGroup);
QVBoxLayout *searchLayout = new QVBoxLayout();
searchGroup->setLayout(searchLayout);
QLabel *searchLabel = new QLabel(searchGroup);
searchLabel->setText(tr("Search"));
searchLayout->addWidget(searchLabel);
search = new QLineEdit(searchGroup);
searchLayout->addWidget(search);
searchRegExp = new QCheckBox(searchGroup);
searchRegExp->setText(tr("Regular expression"));
searchLayout->addWidget(searchRegExp);
//searchRegExp->hide();
// Replace
QGroupBox *replaceGroup = new QGroupBox(this);
replaceGroup->setTitle(tr("Replace"));
vlayout->addWidget(replaceGroup);
QVBoxLayout *replaceLayout = new QVBoxLayout();
replaceGroup->setLayout(replaceLayout);
QLabel *replaceLabel = new QLabel(replaceGroup);
replaceLabel->setText(tr("Replace"));
replaceLayout->addWidget(replaceLabel);
replace = new QLineEdit(replaceGroup);
replaceLayout->addWidget(replace);
// Options
QGroupBox *optionsGroup = new QGroupBox(this);
optionsGroup->setTitle(tr("Options"));
vlayout->addWidget(optionsGroup);
QHBoxLayout *optionsLayout = new QHBoxLayout();
optionsGroup->setLayout(optionsLayout);
QVBoxLayout *optionsV1Layout = new QVBoxLayout();
optionsLayout->addLayout(optionsV1Layout);
QVBoxLayout *optionsV2Layout = new QVBoxLayout();
optionsLayout->addLayout(optionsV2Layout);
caseSensitiveCB = new QCheckBox(optionsGroup);
caseSensitiveCB->setText(tr("Case sensitive"));
optionsV1Layout->addWidget(caseSensitiveCB);
wholeWordsCB = new QCheckBox(optionsGroup);
wholeWordsCB->setText(tr("Only full words"));
optionsV1Layout->addWidget(wholeWordsCB);
fromCursorCB = new QCheckBox(optionsGroup);
fromCursorCB->setText(tr("From cursor"));
optionsV2Layout->addWidget(fromCursorCB);
// Buttons
QHBoxLayout *buttonsLayout = new QHBoxLayout();
vlayout->addLayout(buttonsLayout);
QPushButton *acceptButton = new QPushButton(this);
acceptButton->setText(tr("Search"));
buttonsLayout->addWidget(acceptButton);
connect(acceptButton, SIGNAL(clicked()), this, SIGNAL(search_signal()));
QPushButton *replaceButton = new QPushButton(this);
replaceButton->setText(tr("Replace"));
buttonsLayout->addWidget(replaceButton);
connect(replaceButton, SIGNAL(clicked()), this, SIGNAL(replace_signal()));
QPushButton *cancelButton = new QPushButton(this);
cancelButton->setText(tr("Cancel"));
buttonsLayout->addWidget(cancelButton);
connect(cancelButton, SIGNAL(clicked()), this, SLOT(accept()));
}
示例11: QMainWindow
BitcoinGUI::BitcoinGUI(QWidget *parent):
QMainWindow(parent),
clientModel(0),
walletModel(0),
toolbar(0),
encryptWalletAction(0),
changePassphraseAction(0),
unlockWalletAction(0),
lockWalletAction(0),
aboutQtAction(0),
trayIcon(0),
notificator(0),
rpcConsole(0),
prevBlocks(0),
nWeight(0)
{
resize(970, 550);
setWindowTitle(tr("SatoshiChain") + " - " + tr("Wallet"));
qApp->setStyleSheet("QMainWindow { background-image: url(:images/bkg);border:none;font-family:'Open Sans,sans-serif'; } #frame { } QToolBar QLabel { padding-top: 0px;padding-bottom: 0px;spacing: 10px;} QToolBar QLabel:item { padding-top: 0px;padding-bottom: 0px;spacing: 10px;} #spacer { background:rgb(200,200,200);border:none; } #toolbar2 { border:none;width:0px;hight:0px;padding-top:0px;padding-bottom:0px; background: rgb(104,104,104); } #toolbar { border:1px;height:100%;padding-top:20px; background: rgb(200,200,200); text-align: left; color: black;min-width:150px;max-width:150px;} QToolBar QToolButton:hover {background-color:qlineargradient(x1: 0, y1: 0, x2: 2, y2: 2,stop: 0 rgb(200,200,200), stop: 1 rgb(104,104,104),stop: 2 rgb(104,104,104));}"
#ifdef Q_OS_MAC
"QToolBar QToolButton { font-family:sans-serif;font-size:12px;padding-left:20px;padding-right:45px;padding-top:5px;padding-bottom:5px; width:100%; color: rgb(104,104,104); text-align: left; background-color: rgb(200,200,200); }"
#else
"QToolBar QToolButton { font-family:sans-serif;font-size:12px;padding-left:20px;padding-right:150px;padding-top:5px;padding-bottom:5px; width:100%; color: rgb(104,104,104); text-align: left; background-color: rgb(200,200,200); }"
#endif
"#labelMiningIcon { padding-left:5px;font-family:sans-serif;width:100%;font-size:10px;text-align:center;color:black; } QMenu { background: rgb(200,200,200); color:black; padding-bottom:10px; } QMenu::item { color:black; background-color: transparent; } QMenu::item:selected { background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 rgb(200,200,200), stop: 1 rgb(200,200,200)); } QMenuBar { background: rgb(200,200,200); color:black; } QMenuBar::item { font-size:12px;padding-bottom:6px;padding-top:6px;padding-left:15px;padding-right:15px;color:black; background-color: transparent; } QMenuBar::item:selected { background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 rgb(200,200,200), stop: 1 rgb(200,200,200)); }");
#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);
centralStackedWidget = new QStackedWidget(this);
centralStackedWidget->addWidget(overviewPage);
//centralStackedWidget->addWidget(transactionsPage);
//centralStackedWidget->addWidget(addressBookPage);
//centralStackedWidget->addWidget(receiveCoinsPage);
//centralStackedWidget->addWidget(sendCoinsPage);
QWidget *centralWidget = new QWidget();
QVBoxLayout *centralLayout = new QVBoxLayout(centralWidget);
#ifndef Q_OS_MAC
centralLayout->addWidget(appMenuBar);
#endif
centralLayout->addWidget(centralStackedWidget);
setCentralWidget(centralWidget);
// Status bar notification icons
labelEncryptionIcon = new QLabel();
labelStakingIcon = new QLabel();
labelConnectionsIcon = new QLabel();
labelBlocksIcon = new QLabel();
//actionConvertIcon = new QAction(QIcon(":/icons/statistics"), tr(""), this);
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();
//.........这里部分代码省略.........
示例12: QWidget
KiloWindow::KiloWindow(QWidget *parent): QWidget(parent), device(0), sending(false), connected(false) {
// Create status bar
status = new QStatusBar();
status->showMessage("disconnected.");
status->setSizeGripEnabled(false);
// Create status bar button
connect_button = new QToolButton(status);
status->addPermanentWidget(connect_button);
connect_button->setText("Connect");
connect(connect_button, SIGNAL(clicked()), this, SLOT(toggleConnection()));
// Create serial input window and its trigger button
serial_button = new QPushButton("Serial Input");
serial = new SerialWindow("Serial Input", this);
QObject::connect(serial_button, SIGNAL(clicked()), this, SLOT(serialShow()));
// Create calibration window and its trigger button
calib_button = new QPushButton("Calibration");
calib = new CalibWindow("Calibration Values", this);
QObject::connect(calib_button, SIGNAL(clicked()), this, SLOT(calibShow()));
connect(calib, SIGNAL(calibUID(int)), this, SLOT(calibUID(int)));
connect(calib, SIGNAL(calibLeft(int)), this, SLOT(calibLeft(int)));
connect(calib, SIGNAL(calibRight(int)), this, SLOT(calibRight(int)));
connect(calib, SIGNAL(calibStraight(int)), this, SLOT(calibStraight(int)));
connect(calib, SIGNAL(calibStop()), this, SLOT(calibStop()));
connect(calib, SIGNAL(calibSave()), this, SLOT(calibSave()));
QVBoxLayout *vbox = new QVBoxLayout;
vbox->addWidget(createDeviceSelect());
vbox->addWidget(createFileInput());
vbox->addWidget(createCommands());
vbox->addWidget(serial_button);
vbox->addWidget(calib_button);
vbox->addWidget(status);
setLayout(vbox);
setWindowTitle("Kilobots Toolkit");
setWindowIcon(QIcon(":/images/kilogui.png"));
setWindowState(Qt::WindowActive);
vusb_conn = new VUSBConnection();
ftdi_conn = new FTDIConnection();
serial_conn = new SerialConnection();
connect(ftdi_conn, SIGNAL(readText(QString)), serial, SLOT(addText(QString)));
connect(serial_conn, SIGNAL(readText(QString)), serial, SLOT(addText(QString)));
connect(vusb_conn, SIGNAL(error(QString)), this, SLOT(showError(QString)));
connect(vusb_conn, SIGNAL(status(QString)), this, SLOT(vusbUpdateStatus(QString)));
connect(ftdi_conn, SIGNAL(error(QString)), this, SLOT(showError(QString)));
connect(ftdi_conn, SIGNAL(status(QString)), this, SLOT(ftdiUpdateStatus(QString)));
connect(serial_conn, SIGNAL(error(QString)), this, SLOT(showError(QString)));
connect(serial_conn, SIGNAL(status(QString)), this, SLOT(serialUpdateStatus(QString)));
// Create thread
QThread *thread = new QThread();
connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
// Move connections to thread
vusb_conn->moveToThread(thread);
ftdi_conn->moveToThread(thread);
serial_conn->moveToThread(thread);
// Start thread and open connections
thread->start();
vusb_conn->open();
ftdi_conn->open();
serial_conn->open();
}
示例13: QMainWindow
MainWindow::MainWindow(int argc, char** argv, QWidget *parent)
: QMainWindow(parent)
, qnode(argc,argv)
,timer()
,scene()
//, gps(argc,argv)
{
ui.setupUi(this); // Calling this incidentally connects all ui's triggers to on_...() callbacks in this class.
QObject::connect(ui.actionAbout_Qt, SIGNAL(triggered(bool)), qApp, SLOT(aboutQt())); // qApp is a global variable for the application
ReadSettings();
setWindowIcon(QIcon(":/images/icon.png"));
ui.tab_manager->setCurrentIndex(0); // ensure the first tab is showing - qt-designer should have this already hardwired, but often loses it (settings?).
QObject::connect(&qnode, SIGNAL(rosShutdown()), this, SLOT(close()));
//QObject::connect(&gps, SIGNAL(rosShutdown()), this, SLOT(close()));
/*********************
** Logging
**********************/
ui.view_logging->setModel(qnode.loggingModel());
QObject::connect(&qnode, SIGNAL(loggingUpdated()), this, SLOT(updateLoggingView()));
//Mesaj detayları
//QImuMesajEditGrup egrup;
ui.viewFrontCamera->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
ui.viewFrontCamera->setScaledContents(true);
ui.viewPTZCamera->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
ui.viewPTZCamera->setScaledContents(true);
QObject::connect(&qnode,SIGNAL(imuSignal_accelX(QString)),ui.lineAccelX,SLOT(setText(QString)));
QObject::connect(&qnode,SIGNAL(imuSignal_accelY(QString)),ui.lineAccelY,SLOT(setText(QString)));
QObject::connect(&qnode,SIGNAL(imuSignal_accelZ(QString)),ui.lineAccelZ,SLOT(setText(QString)));
QObject::connect(&qnode,SIGNAL(imuSignal_gyroX(QString)),ui.lineGyroX,SLOT(setText(QString)));
QObject::connect(&qnode,SIGNAL(imuSignal_gyroY(QString)),ui.lineGyroY,SLOT(setText(QString)));
QObject::connect(&qnode,SIGNAL(imuSignal_gyroZ(QString)),ui.lineGyroZ,SLOT(setText(QString)));
QObject::connect(&qnode,SIGNAL(imuSignal_magnetomX(QString)),ui.lineMagnetomX,SLOT(setText(QString)));
QObject::connect(&qnode,SIGNAL(imuSignal_magnetomY(QString)),ui.lineMagnetomY,SLOT(setText(QString)));
QObject::connect(&qnode,SIGNAL(imuSignal_magnetomZ(QString)),ui.lineMagnetomZ,SLOT(setText(QString)));
QObject::connect(&qnode,SIGNAL(imuSignal_raw(QString)),ui.lineIMURaw,SLOT(setText(QString)));
QObject::connect(&qnode,SIGNAL(gpsSignal_raw(QString)),ui.lineGPSRaw,SLOT(setText(QString)));
QObject::connect(&qnode,SIGNAL(gpsSignal_latitude(QString)),ui.lineLatitude,SLOT(setText(QString)));
QObject::connect(&qnode,SIGNAL(gpsSignal_longtitude(QString)),ui.lineLongtitude,SLOT(setText(QString)));
QObject::connect(&qnode,SIGNAL(gpsSignal_cog(QString)),ui.lineGPSCOG,SLOT(setText(QString)));
QObject::connect(&qnode,SIGNAL(gpsSignal_vog(QString)),ui.lineGPSVOG,SLOT(setText(QString)));
QObject::connect(&qnode,SIGNAL(gpsSignal_quality(QString)),ui.lineGPSQuality,SLOT(setText(QString)));
qRegisterMetaType<sensor_msgs::LaserScan>("sensor_msgs::LaserScan");
QObject::connect(&qnode,SIGNAL(scanSignal(const sensor_msgs::LaserScan)),this,SLOT(updateScan(sensor_msgs::LaserScan)));
qRegisterMetaType<cv::Mat>("cv::Mat");
QObject::connect(&qnode,SIGNAL(frontCamera_signal(cv::Mat)),this,SLOT(getFrontCameraImage(cv::Mat)));
QObject::connect(&qnode,SIGNAL(ptzCamera_signal(cv::Mat)),this,SLOT(getPTZCameraImage(cv::Mat)));
qRegisterMetaType<axis_camera::Axis>("axis_camera::Axis");
QObject::connect(&qnode,SIGNAL(ptzStatus_signal(axis_camera::Axis)),this,SLOT(getPTZCameraStatus(axis_camera::Axis)));
QObject::connect(ui.buttonPTZPan,SIGNAL(clicked()),this,SLOT(button_PTZPan_clicked()));
QObject::connect(ui.buttonPTZTilt,SIGNAL(clicked()),this,SLOT(button_PTZTilt_clicked()));
QObject::connect(ui.buttonSendVelocity,SIGNAL(clicked()),this,SLOT(on_buttonSendVelocity_clicked()));
QObject::connect(ui.buttonSendVelocity_2,SIGNAL(clicked()),this,SLOT(on_buttonSendVelocity_2_clicked()));
QObject::connect(ui.buttonSendVelocity_3,SIGNAL(clicked()),this,SLOT(on_buttonSendVelocity_3_clicked()));
QObject::connect(ui.buttonSendVelocity_4,SIGNAL(clicked()),this,SLOT(on_buttonSendVelocity_4_clicked()));
/*********************
** Auto Start
**********************/
if ( ui.checkbox_remember_settings->isChecked() ) {
on_button_connect_clicked(true);
}
////////////////////////////////////////////////////////////////////////
qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
scene.setSceneRect(-1600,-1600, 3200, 3200);
scene.setItemIndexMethod(QGraphicsScene::NoIndex);
scanview = new ScanWiew();
scanview->setPos(0,0);
scene.addItem(scanview);
/*
for (int i = 0; i < MouseCount; ++i) {
ScanWiew *mouse = new ScanWiew;
mouse->setPos(::sin((i * 6.28) / MouseCount) * 200,
::cos((i * 6.28) / MouseCount) * 200);
scene.addItem(mouse);
}*/
//.........这里部分代码省略.........
示例14: searchTab
tagTab::tagTab(int id, QMap<QString,Site*> *sites, QList<Favorite> favorites, mainWindow *parent)
: searchTab(id, sites, parent), ui(new Ui::tagTab), m_id(id), m_parent(parent), m_favorites(favorites), m_pagemax(-1), m_lastTags(QString()), m_sized(false), m_from_history(false), m_stop(true), m_history_cursor(0), m_history(QList<QMap<QString,QString> >()), m_modifiers(QStringList())
{
ui->setupUi(this);
ui->widgetMeant->hide();
setAttribute(Qt::WA_DeleteOnClose);
QSettings settings(savePath("settings.ini"), QSettings::IniFormat, this);
m_ignored = loadIgnored();
// Search fields
QStringList favs;
for (Favorite fav : m_favorites)
favs.append(fav.getName());
m_search = new TextEdit(favs, this);
m_postFiltering = new TextEdit(favs, this);
m_search->setContextMenuPolicy(Qt::CustomContextMenu);
m_postFiltering->setContextMenuPolicy(Qt::CustomContextMenu);
if (settings.value("autocompletion", true).toBool())
{
QFile words("words.txt");
if (words.open(QIODevice::ReadOnly | QIODevice::Text))
{
while (!words.atEnd())
m_completion.append(QString(words.readLine()).trimmed().split(" ", QString::SkipEmptyParts));
words.close();
}
QFile wordsc(savePath("wordsc.txt"));
if (wordsc.open(QIODevice::ReadOnly | QIODevice::Text))
{
while (!wordsc.atEnd())
m_completion.append(QString(wordsc.readLine()).trimmed().split(" ", QString::SkipEmptyParts));
wordsc.close();
}
for (int i = 0; i < sites->size(); i++)
if (sites->value(sites->keys().at(i))->contains("Modifiers"))
m_modifiers.append(sites->value(sites->keys().at(i))->value("Modifiers").trimmed().split(" ", QString::SkipEmptyParts));
m_completion.append(m_modifiers);
m_completion.append(favs);
m_completion.removeDuplicates();
m_completion.sort();
QCompleter *completer = new QCompleter(m_completion, this);
completer->setCaseSensitivity(Qt::CaseInsensitive);
m_search->setCompleter(completer);
m_postFiltering->setCompleter(completer);
}
connect(m_search, SIGNAL(returnPressed()), this, SLOT(load()));
connect(m_search, SIGNAL(favoritesChanged()), _mainwindow, SLOT(updateFavorites()));
connect(m_search, SIGNAL(favoritesChanged()), _mainwindow, SLOT(updateFavoritesDock()));
connect(m_search, SIGNAL(kflChanged()), _mainwindow, SLOT(updateKeepForLater()));
connect(m_postFiltering, SIGNAL(returnPressed()), this, SLOT(load()));
connect(ui->labelMeant, SIGNAL(linkActivated(QString)), this, SLOT(setTags(QString)));
ui->layoutFields->insertWidget(1, m_search, 1);
ui->layoutPlus->addWidget(m_postFiltering, 1, 1, 1, 3);
// Sources
QString sel = '1'+QString().fill('0',m_sites->count()-1);
QString sav = settings.value("sites", sel).toString();
for (int i = 0; i < sel.count(); i++)
{
if (sav.count() <= i)
{ sav[i] = '0'; }
m_selectedSources.append(sav.at(i) == '1' ? true : false);
}
// Others
ui->checkMergeResults->setChecked(settings.value("mergeresults", false).toBool());
optionsChanged();
ui->widgetPlus->hide();
setWindowIcon(QIcon());
updateCheckboxes();
m_search->setFocus();
}
示例15: QMainWindow
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
quitDialog(0), saveChanges(false),
newJobFileName(""), newJobDestinationDirectory("")
{
m_has_error_happend = false;
QMetaObject::invokeMethod(this, "loadSettings", Qt::QueuedConnection);
setWindowIcon(QIcon(":/ui/icons/motocool.jpg"));
// Initiallize headers
QStringList headers;
headers << tr("Name") << tr("Downloaded/Total") << tr("Progress") << tr("Speed")
<< tr("Status") << tr("Remaining time");
// Main job list
jobView = new JobView(this);
jobView->setHeaderLabels(headers);
jobView->setSelectionBehavior(QAbstractItemView::SelectRows);
jobView->setAlternatingRowColors(true);
jobView->setRootIsDecorated(false);
setCentralWidget(jobView);
// Set header resize modes and initial section sizes
QFontMetrics fm = fontMetrics();
QHeaderView *header = jobView->header();
header->resizeSection(0, fm.width("typical-name-length-for-a-download-task"));
header->resizeSection(1, fm.width(headers.at(1) + "100MB/999MB"));
header->resizeSection(2, fm.width(headers.at(2) + "100%"));
header->resizeSection(3, qMax(fm.width(headers.at(3) + " "), fm.width(" 1023.0 KB/s")));
header->resizeSection(4, qMax(fm.width(headers.at(4) + " "), fm.width(tr("Downloading ") + " ")));
header->resizeSection(5, qMax(fm.width(headers.at(5) + " "), fm.width(tr("--:--") + " ")));
// Create common actions
QAction *newJobAction = new QAction(QIcon(":/ui/icons/bottom.png"), tr("Add &new job"), this);
pauseJobAction = new QAction(QIcon(":/ui/icons/player_pause.png"), tr("&Pause job"), this);
removeJobAction = new QAction(QIcon(":/ui/icons/player_stop.png"), tr("&Remove job"), this);
openDirAction = new QAction(QIcon(":/ui/icons/folder.png"), tr("Open file &directory"), this);
// File menu
QMenu *fileMenu = menuBar()->addMenu(tr("&File"));
fileMenu->addAction(newJobAction);
fileMenu->addAction(pauseJobAction);
fileMenu->addAction(removeJobAction);
fileMenu->addAction(openDirAction);
fileMenu->addSeparator();
fileMenu->addAction(QIcon(":/ui/icons/exit.png"), tr("E&xit"), this, SLOT(close()));
// Help Menu
QMenu *helpMenu = menuBar()->addMenu(tr("&Help"));
helpMenu->addAction(tr("&About"), this, SLOT(about()));
// Top toolbar
QToolBar *topBar = new QToolBar(tr("Tools"));
addToolBar(Qt::TopToolBarArea, topBar);
topBar->setMovable(false);
topBar->addAction(newJobAction);
topBar->addAction(pauseJobAction);
topBar->addAction(removeJobAction);
topBar->addAction(openDirAction);
pauseJobAction->setEnabled(false);
removeJobAction->setEnabled(false);
openDirAction->setEnabled(false);
// Set up connections
connect(jobView, SIGNAL(itemSelectionChanged()),
this, SLOT(setActionsEnabled()));
connect(newJobAction, SIGNAL(triggered()),
this, SLOT(addJob()));
connect(pauseJobAction, SIGNAL(triggered()),
this, SLOT(pauseJob()));
connect(removeJobAction, SIGNAL(triggered()),
this, SLOT(removeJob()));
connect(openDirAction, SIGNAL(triggered()),
this, SLOT(openDir()));
}