void QWSMainWindow::slot_newProject() { m_pDatabaseAdapater = new CDatabaseAdapter; m_pDatabaseAdapater->createDatabase("D:/Projects/ConfigExport/project/wys.projx"); slot_refresh(); }
UBMagnifier::UBMagnifier(QWidget *parent, bool isInteractive) : QWidget(parent, parent ? Qt::Widget : Qt::Tool | (Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint)) , mShouldMoveWidget(false) , mShouldResizeWidget(false) , borderPen(Qt::darkGray) , gView(0) , mView(0) { isCusrsorAlreadyStored = false; setMouseTracking(true); //--------------------------------------------------// QPixmap pix(":/images/cursors/resize.png"); QTransform tr; tr.rotate(45); mResizeCursor = QCursor(pix.transformed(tr, Qt::SmoothTransformation), pix.width() / 2, pix.height() / 2); //--------------------------------------------------// params.sizePercentFromScene = 20; m_isInteractive = isInteractive; sClosePixmap = new QPixmap(":/images/close.svg"); sIncreasePixmap = new QPixmap(":/images/increase.svg"); sDecreasePixmap = new QPixmap(":/images/decrease.svg"); mResizeItem = new QPixmap(":/images/resize.svg"); sChangeModePixmap = new QPixmap(); setDrawingMode(UBSettings::settings()->magnifierDrawingMode->get().toInt()); if (parent) { setAttribute(Qt::WA_NoMousePropagation); } else { // standalone window // !!!! Should be included into Windows after QT recompilation #ifndef Q_WS_WIN // setAttribute(Qt::WA_TranslucentBackground); setAttribute(Qt::WA_MacAlwaysShowToolWindow); #endif #ifdef Q_WS_MAC setAttribute(Qt::WA_MacAlwaysShowToolWindow); setAttribute(Qt::WA_MacNonActivatingToolWindow); setAttribute(Qt::WA_MacNoShadow); #endif } connect(&mRefreshTimer, SIGNAL(timeout()), this, SLOT(slot_refresh())); }
void QWSMainWindow::initMenu() { m_fileMenu = menuBar()->addMenu(QStringLiteral("文件(&F)")); m_fileNewAction = new QAction(QIcon(":/filenew.png"), QStringLiteral("新建"), this); connect(m_fileNewAction, SIGNAL(triggered()), this, SLOT(slot_newProject())); m_fileOpenAction = new QAction(QIcon(":/open.png"), QStringLiteral("打开"), this); connect(m_fileOpenAction, SIGNAL(triggered()), this, SLOT(slot_openProject())); m_fileSaveAction = new QAction(QIcon(":/save.png"), QStringLiteral("保存"), this); connect(m_fileSaveAction, SIGNAL(triggered()), this, SLOT(slot_saveProject())); m_fileQuit = new QAction(QIcon(":/exit.png"), QStringLiteral("退出"), this); m_fileQuit->setShortcut(QKeySequence::Quit); connect(m_fileQuit, SIGNAL(triggered()), this, SLOT(close())); m_fileMenu->addAction(m_fileOpenAction); m_fileMenu->addSeparator(); m_fileMenu->addAction(m_fileSaveAction); m_fileMenu->addSeparator(); m_fileMenu->addAction(m_fileQuit); m_editMenu = menuBar()->addMenu(QStringLiteral("编辑(&E)")); m_layerMenu = menuBar()->addMenu(QStringLiteral("查看(&L)")); m_EditRefresh = new QAction(QIcon(":/refresh.png"), QStringLiteral("刷新"), this); m_EditRefresh->setShortcut(QKeySequence::Refresh); connect(m_EditRefresh, SIGNAL(triggered()), this, SLOT(slot_refresh())); m_helpMenu = menuBar()->addMenu(QStringLiteral("调试(&D)")); m_helpMenu = menuBar()->addMenu(QStringLiteral("网络(&N)")); m_helpMenu = menuBar()->addMenu(QStringLiteral("其它(&O)")); m_helpMenu = menuBar()->addMenu(QStringLiteral("关于(&H)")); QAction* aboutAction = new QAction(QIcon(":/about.png"), tr("About"), this); m_helpMenu->addAction(aboutAction); connect(aboutAction, SIGNAL(triggered()), this, SLOT(slot_about())); }