GLWidget::GLWidget(QWidget *parent) : QGLWidget(parent), cc_(CamerasContainer::getInstance()) { setMouseTracking(false); }
void DkControlWidget::init() { // debug: show invisible widgets setFocusPolicy(Qt::StrongFocus); setFocus(Qt::TabFocusReason); setMouseTracking(true); // connect widgets with their settings mFilePreview->setDisplaySettings(&Settings::param().app().showFilePreview); mMetaDataInfo->setDisplaySettings(&Settings::param().app().showMetaData); mFileInfoLabel->setDisplaySettings(&Settings::param().app().showFileInfoLabel); mPlayer->setDisplaySettings(&Settings::param().app().showPlayer); mHistogram->setDisplaySettings(&Settings::param().app().showHistogram); mCommentWidget->setDisplaySettings(&Settings::param().app().showComment); mZoomWidget->setDisplaySettings(&Settings::param().app().showOverview); mFolderScroll->setDisplaySettings(&Settings::param().app().showScroller); // some adjustments mBottomLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); mBottomLeftLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); mRatingLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); mZoomWidget->setContentsMargins(10, 10, 0, 0); mCropWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); mCommentWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); // register actions DkActionManager& am = DkActionManager::instance(); mFilePreview->registerAction(am.action(DkActionManager::menu_panel_preview)); mMetaDataInfo->registerAction(am.action(DkActionManager::menu_panel_exif)); mPlayer->registerAction(am.action(DkActionManager::menu_panel_player)); mCropWidget->registerAction(am.action(DkActionManager::menu_edit_crop)); mFileInfoLabel->registerAction(am.action(DkActionManager::menu_panel_info)); mHistogram->registerAction(am.action(DkActionManager::menu_panel_histogram)); mCommentWidget->registerAction(am.action(DkActionManager::menu_panel_comment)); mFolderScroll->registerAction(am.action(DkActionManager::menu_panel_scroller)); // dummy - needed for three equal columns @markus: do not delete! QWidget* dw = new QWidget(this); dw->setMouseTracking(true); QBoxLayout* dLayout = new QBoxLayout(QBoxLayout::LeftToRight, dw); dLayout->setContentsMargins(0,0,0,0); dLayout->addWidget(mBottomLabel); dLayout->addStretch(); // zoom widget QWidget* bw = new QWidget(this); bw->setMouseTracking(true); //bw->setMinimumHeight(40); //bw->setMaximumHeight(80); QVBoxLayout* zLayout = new QVBoxLayout(bw); zLayout->setAlignment(Qt::AlignBottom); zLayout->setContentsMargins(0,0,0,20); zLayout->setSpacing(0); zLayout->addWidget(mBottomLabel); zLayout->addWidget(mBottomLeftLabel); zLayout->addWidget(mCommentWidget); // left column widget QWidget* leftWidget = new QWidget(this); leftWidget->setMouseTracking(true); QBoxLayout* ulLayout = new QBoxLayout(QBoxLayout::TopToBottom, leftWidget); ulLayout->setContentsMargins(0,0,0,0); ulLayout->setSpacing(0); ulLayout->addWidget(mZoomWidget); ulLayout->addStretch(); ulLayout->addWidget(bw); ulLayout->addWidget(dw); // center column QWidget* center = new QWidget(this); center->setMouseTracking(true); QVBoxLayout* cLayout = new QVBoxLayout(center); cLayout->setContentsMargins(0,0,0,0); cLayout->setAlignment(Qt::AlignBottom); cLayout->addWidget(mPlayer); // rating widget QWidget* rw = new QWidget(this); rw->setMouseTracking(true); rw->setMinimumSize(0,0); QBoxLayout* rLayout = new QBoxLayout(QBoxLayout::RightToLeft, rw); rLayout->setContentsMargins(0,0,0,17); rLayout->addWidget(mRatingLabel); rLayout->addStretch(); // file info QWidget* fw = new QWidget(this); fw->setContentsMargins(0,0,0,30); fw->setMouseTracking(true); fw->setMinimumSize(0,0); QBoxLayout* rwLayout = new QBoxLayout(QBoxLayout::RightToLeft, fw); rwLayout->setContentsMargins(0,0,0,0); rwLayout->addWidget(mFileInfoLabel); rwLayout->addStretch(); // right column QWidget* hw = new QWidget(this); hw->setContentsMargins(0,10,10,0); hw->setMouseTracking(true); QBoxLayout* hwLayout = new QBoxLayout(QBoxLayout::RightToLeft, hw); hwLayout->setContentsMargins(0,0,0,0); hwLayout->addWidget(mHistogram); hwLayout->addStretch(); // right column QWidget* rightWidget = new QWidget(this); rightWidget->setMouseTracking(true); QBoxLayout* lrLayout = new QBoxLayout(QBoxLayout::TopToBottom, rightWidget); lrLayout->setContentsMargins(0,0,0,0); lrLayout->addWidget(hw); lrLayout->addStretch(); lrLayout->addWidget(fw); lrLayout->addWidget(rw); // init main widgets mWidgets.resize(widget_end); mWidgets[hud_widget] = new QWidget(this); mWidgets[crop_widget] = mCropWidget; // global controller layout mHudLayout = new QGridLayout(mWidgets[hud_widget]); mHudLayout->setContentsMargins(0,0,0,0); mHudLayout->setSpacing(0); //hudLayout->addWidget(thumbWidget, 0, 0); // add elements changeThumbNailPosition(mFilePreview->getWindowPosition()); changeMetaDataPosition(mMetaDataInfo->getWindowPosition()); //hudLayout->addWidget(filePreview, top_thumbs, left_thumbs, 1, hor_pos_end); mHudLayout->addWidget(leftWidget, ver_center, left, 1, 1); mHudLayout->addWidget(center, ver_center, hor_center, 1, 1); mHudLayout->addWidget(rightWidget, ver_center, right, 1, 1); mHudLayout->addWidget(mFolderScroll, top_scroll, left_thumbs, 1, hor_pos_end); //// we need to put everything into extra widgets (which are exclusive) in order to handle the mouse events correctly //QHBoxLayout* editLayout = new QHBoxLayout(widgets[crop_widget]); //editLayout->setContentsMargins(0,0,0,0); //editLayout->addWidget(cropWidget); mLayout = new QStackedLayout(this); mLayout->setContentsMargins(0,0,0,0); for (int idx = 0; idx < mWidgets.size(); idx++) mLayout->addWidget(mWidgets[idx]); //// debug code... //centerLabel->setText("ich bin richtig...", -1); //bottomLeftLabel->setText("topLeft label...", -1); //spinnerLabel->show(); show(); //thumbWidget->setVisible(true); }
M11TabBar::M11TabBar(M11TabWidget *parent) : ::QTabBar((QWidget *)parent) { setMouseTracking(true); }
DisplayOptionsWidget::DisplayOptionsWidget(QWidget *parent) : QWidget(parent) , set(Settings::instance()) , m_serverMode(set->getCurrentServerMode()) , m_hwInterface(set->getHWInterface()) , m_dataEngineState(set->getDataEngineState()) , m_antialiased(true) , m_mouseOver(false) , m_minimumWidgetWidth(set->getMinimumWidgetWidth()) , m_minimumGroupBoxWidth(set->getMinimumGroupBoxWidth()) , m_btnSpacing(5) , m_currentReceiver(set->getCurrentReceiver()) , m_btnChooserHit(0) , m_framesPerSecond(set->getFramesPerSecond(m_currentReceiver)) , m_sampleRate(set->getSampleRate()) , m_sMeterHoldTime(set->getSMeterHoldTime()) { //setMinimumWidth(m_minimumWidgetWidth); setContentsMargins(4, 0, 4, 0); setMouseTracking(true); m_rxDataList = set->getReceiverDataList(); m_widebandOptions = set->getWidebandOptions(); m_panadapterMode = set->getPanadapterMode(m_currentReceiver); m_waterColorMode = set->getWaterfallColorMode(m_currentReceiver); fonts = new CFonts(this); m_fonts = fonts->getFonts(); createFPSGroupBox(); createPanSpectrumOptions(); createWidebandPanOptions(); createWaterfallSpectrumOptions(); createSMeterOptions(); createCallSignEditor(); QBoxLayout *mainLayout = new QBoxLayout(QBoxLayout::TopToBottom, this); mainLayout->setSpacing(5); mainLayout->setMargin(0); mainLayout->addSpacing(8); QHBoxLayout *hbox1 = new QHBoxLayout; hbox1->setSpacing(0); hbox1->setMargin(0); hbox1->addStretch(); hbox1->addWidget(m_fpsGroupBox); QHBoxLayout *hbox2 = new QHBoxLayout; hbox2->setSpacing(0); hbox2->setMargin(0); hbox2->addStretch(); hbox2->addWidget(m_panSpectrumOptions); QHBoxLayout *hbox3 = new QHBoxLayout; hbox3->setSpacing(0); hbox3->setMargin(0); hbox3->addStretch(); hbox3->addWidget(m_widebandPanOptions); QHBoxLayout *hbox4 = new QHBoxLayout; hbox4->setSpacing(0); hbox4->setMargin(0); hbox4->addStretch(); hbox4->addWidget(m_waterfallSpectrumOptions); QHBoxLayout *hbox5 = new QHBoxLayout; hbox5->setSpacing(0); hbox5->setMargin(0); hbox5->addStretch(); hbox5->addWidget(m_sMeterOptions); QHBoxLayout *hbox6 = new QHBoxLayout; hbox6->setSpacing(0); hbox6->setMargin(0); hbox6->addStretch(); hbox6->addWidget(m_callSignEditor); hbox6->addStretch(); mainLayout->addLayout(hbox1); mainLayout->addLayout(hbox2); mainLayout->addLayout(hbox3); mainLayout->addLayout(hbox4); mainLayout->addLayout(hbox5); mainLayout->addLayout(hbox6); mainLayout->addStretch(); setLayout(mainLayout); setupConnections(); }
NavigationSlider::NavigationSlider(QWidget *parent) : QAbstractSlider( parent ), m_handleImagePath( "marble/navigation/navigational_slider_handle" ) { setMouseTracking( true ); }
GNSSView::GNSSView(QStringList & args) { fullScreen=true; for (int i=1;i<args.size();i++){ // skip the first if (args.at(i) == "--nofullscreen") fullScreen=false; else if (args.at(i) == "--help"){ std::cout << "gnssview " << std::endl; std::cout << "Usage: gnssview [options]" << std::endl; std::cout << std::endl; std::cout << "--help print this help" << std::endl; std::cout << "--license print this help" << std::endl; std::cout << "--nofullscreen run in a window" << std::endl; std::cout << "--version display version" << std::endl; exit(EXIT_SUCCESS); } else if (args.at(i) == "--license"){ std::cout << " gnssview - a program for displaying GNSS satellite paths" << std::endl; std::cout << std::endl; std::cout << " The MIT License (MIT)" << std::endl; std::cout << std::endl; std::cout << " Copyright (c) 2014 Michael J. Wouters" << std::endl; std::cout << std::endl; std::cout << " Permission is hereby granted, free of charge, to any person obtaining a copy" << std::endl; std::cout << " of this software and associated documentation files (the \"Software\"), to deal" << std::endl; std::cout << " in the Software without restriction, including without limitation the rights" << std::endl; std::cout << " to use, copy, modify, merge, publish, distribute, sublicense, and/or sell" << std::endl; std::cout << " copies of the Software, and to permit persons to whom the Software is" << std::endl; std::cout << " furnished to do so, subject to the following conditions:" << std::endl; std::cout << std::endl; std::cout << " The above copyright notice and this permission notice shall be included in" << std::endl; std::cout << " all copies or substantial portions of the Software." << std::endl; std::cout << std::endl; std::cout << " THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR" << std::endl; std::cout << " IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY," << std::endl; std::cout << " FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE" << std::endl; std::cout << " AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER" << std::endl; std::cout << " LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM," << std::endl; std::cout << " OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN" << std::endl; std::cout << " THE SOFTWARE." << std::endl; exit(EXIT_SUCCESS); } else if (args.at(i) == "--version"){ std::cout << "gnssview " << VERSION_INFO << std::endl; std::cout << std::endl; std::cout << "This ain't no stinkin' Perl script!" << std::endl; exit(EXIT_SUCCESS); } else{ std::cout << "gnssview: Unknown option '"<< args.at(i).toStdString() << "'" << std::endl; std::cout << "gnssview: Use --help to get a list of available command line options"<< std::endl; exit(EXIT_SUCCESS); } } setWindowTitle(tr("gnssview")); setMinimumSize(QSize(1920,1080)); if (fullScreen) setWindowState(windowState() ^ Qt::WindowFullScreen); setMouseTracking(true); // so that mouse movements wake up the display QCursor curs; curs.setShape(Qt::BlankCursor); setCursor(curs); cursor().setPos(0,0); QTime on(7,0,0); QTime off(19,0,0); powerManager=new PowerManager(on,off); powerManager->enable(false); latitude=-33.87; longitude=151.21; address=""; port=-1; // Note: readConfig needs 'view' QVBoxLayout * vb = new QVBoxLayout(this); vb->setContentsMargins(0,0,0,0); view = new GNSSViewWidget(NULL,&birds); vb->addWidget(view); QString config = app->locateResource("gnssview.xml"); if (!config.isNull()) readConfig(config); view->setLocation(latitude,longitude); createActions(); setContextMenuPolicy(Qt::CustomContextMenu); connect(this,SIGNAL(customContextMenuRequested ( const QPoint & )),this,SLOT(createContextMenu(const QPoint &))); udpSocket = new QUdpSocket(this); udpSocket->bind(port,QUdpSocket::ShareAddress); // Start of flimflummery // Newer versions of Qt support this but for the moment we'll do it the Unix way int socketfd = udpSocket->socketDescriptor(); if (socketfd != -1){ ip_mreq mreq; memset(&mreq,0,sizeof(ip_mreq)); mreq.imr_multiaddr.s_addr = inet_addr(address.toStdString().c_str()); // group addr mreq.imr_interface.s_addr = htons(INADDR_ANY); // use default //Make this a member of the Multicast Group if(setsockopt(socketfd, IPPROTO_IP, IP_ADD_MEMBERSHIP, (const void *)&mreq,sizeof(mreq)) < 0){ qDebug("Failed to add to multicast group"); } // set TTL (Time To Live) unsigned int ttl = 38; // restricted to 38 hops if (setsockopt(socketfd, IPPROTO_IP, IP_MULTICAST_TTL, (const char *)&ttl, sizeof(ttl) ) < 0){ qDebug("Failed to set TTL"); } } else{ qDebug() << "Bad socket fd!"; } // End of flimflummery connect(udpSocket, SIGNAL(readyRead()),this, SLOT(readPendingDatagrams())); updateTimer = new QTimer(this); connect(updateTimer,SIGNAL(timeout()),this,SLOT(updateView())); QDateTime now = QDateTime::currentDateTime(); updateTimer->start(1000-now.time().msec()); }
helpDialog::helpDialog(const QString &path, const QString &page, QWidget *parent) { this->setWindowFlags( Qt::WindowStaysOnTopHint | Qt::SubWindow); this ->setWindowIcon(QIcon(":images/icon.png"));//:images/icon.png setFixedSize(565,540); setFocus(); setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_GroupLeader); textBrowser=new QTextBrowser; textBrowser->setOpenLinks(true); homeButton=new QToolButton(); QPixmap homeButtonpix(":/images/home.png"); homeButton->setIcon(homeButtonpix); homeButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); homeButton->setIconSize(homeButtonpix.size()); homeButton->setText(" 首 页 "); homeButton->setShortcut(tr("Home")); upSection=new QToolButton(); QPixmap upSectionpix(":/images/up.png"); upSection->setIcon(upSectionpix); upSection->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); upSection->setIconSize(upSectionpix.size()); upSection->setText("上一节"); upSection->setToolTip("已经是首页了◕‿◕"); upSection->setShortcut(tr("Left")); downSection=new QToolButton(); QPixmap downSectionpix(":/images/down.png"); downSection->setIcon(downSectionpix); downSection->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); downSection->setIconSize(downSectionpix.size()); downSection->setText("下一节"); downSection->setShortcut(tr("Right")); //backButton=new QToolButton(tr("&Back")); closeButton=new QToolButton(); QPixmap closeButtonpix(":/images/out.png"); closeButton->setIcon(closeButtonpix); closeButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); closeButton->setIconSize(closeButtonpix.size()); closeButton->setText(" 退 出 "); closeButton->setShortcut(tr("Esc")); QHBoxLayout *buttonlayout=new QHBoxLayout; buttonlayout->addWidget(homeButton); buttonlayout->addWidget(upSection); buttonlayout->addWidget(downSection); //buttonlayout->addStretch(); buttonlayout->addWidget(closeButton); buttonlayout->setSpacing(70); QVBoxLayout *mainLayout =new QVBoxLayout; mainLayout->addLayout(buttonlayout); mainLayout->addWidget(textBrowser); setLayout(mainLayout); connect(homeButton,SIGNAL(clicked()),textBrowser,SLOT(home())); //connect(backButton,SIGNAL(clicked()),textBrowser,SLOT(backward())); connect(closeButton,SIGNAL(clicked()),this,SLOT(close())); connect(upSection,SIGNAL(clicked()),this,SLOT(forwardSection())); connect(downSection,SIGNAL(clicked()),this,SLOT(backwardSection())); connect(textBrowser,SIGNAL(sourceChanged(const QUrl &)),this,SLOT(updateWindowTitle())); textBrowser->setSearchPaths(QStringList()<< path <<":/images"); textBrowser->setSource(page); setMouseTracking(true); }
void CountryInput::leaveEvent(QEvent *e) { setMouseTracking(false); _active = false; setCursor(style::cur_default); }
void CountrySelectInner::enterEvent(QEvent *e) { setMouseTracking(true); }
QMessageBoxResize(QWidget *parent = 0) : QMessageBox(parent) { setMouseTracking(true); setSizeGripEnabled(true); }
void CountryInput::enterEvent(QEvent *e) { setMouseTracking(true); }
//============================================================================= sstQt01PathPaintWidgetCls::sstQt01PathPaintWidgetCls(sstMisc01PrtFilCls *poTmpPrt, sstQt01PathStoreViewCls *poTmpPathStorage) { Q_INIT_RESOURCE(tooltips); if (poTmpPathStorage == NULL) assert (0); if (poTmpPathStorage->countItems() <= 0) assert(0); this->oPathStorage = poTmpPathStorage; this->poPrt = poTmpPrt; setMouseTracking(true); setBackgroundRole(QPalette::Base); newCircleButton = createToolButton(tr("New Circle"), QIcon(":/images/circle.png"), SLOT(createNewCircle())); newSquareButton = createToolButton(tr("New Square"), QIcon(":/images/square.png"), SLOT(createNewSquare())); newTriangleButton = createToolButton(tr("New Triangle"), QIcon(":/images/triangle.png"), SLOT(createNewTriangle())); newLineButton = createToolButton(tr("New Line"), QIcon(":/images/line.png"), SLOT(createNewLine())); newPolyLineButton = createToolButton(tr("New PolyLine"), QIcon(":/images/polyline.png"), SLOT(createNewPolyLine())); newArcButton = createToolButton(tr("New Arc"), QIcon(":/images/arc.png"), SLOT(createNewArc())); newTextButton = createToolButton(tr("New Text"), QIcon(":/images/text.png"), SLOT(createNewText())); //============================================================================= // Create item templates circlePath.addEllipse(QRect(0, 0, 100, 100)); squarePath.addRect(QRect(0, 0, 100, 100)); qreal x = trianglePath.currentPosition().x(); qreal y = trianglePath.currentPosition().y(); trianglePath.moveTo(x + 120 / 2, y); trianglePath.lineTo(0, 100); trianglePath.lineTo(120, 100); trianglePath.lineTo(x + 120 / 2, y); linePath.moveTo( 0, 0); linePath.lineTo(100, 100); polylinePath.moveTo( 0, 0); polylinePath.lineTo(25, 75); polylinePath.lineTo(100, 100); // arcPath.moveTo( 150, 150); QRect oRect(100,100,200,200); arcPath.arcMoveTo(oRect,0); arcPath.arcTo(oRect,0,45); QFont oFont; oFont.setPointSize(50); // oFont.s QString oQStr = "A"; textPath.moveTo( 0, 0); textPath.addText(50,50,oFont,oQStr); //============================================================================= setWindowTitle(tr("Tool Tips")); this->setMinimumSize(350,350); // Get Size for 7 Buttons iActualItemIndex = 0; iItemInMotionIndex = 0; }
QgsMapCanvas::QgsMapCanvas( QWidget * parent ) : QGraphicsView( parent ) , mCanvasProperties( new CanvasProperties ) , mMap( nullptr ) , mFrozen( false ) , mRefreshScheduled( false ) , mRenderFlag( true ) // by default, the canvas is rendered , mCurrentLayer( nullptr ) , mScene( nullptr ) , mMapTool( nullptr ) , mLastNonZoomMapTool( nullptr ) , mLastExtentIndex( -1 ) , mWheelZoomFactor( 2.0 ) , mJob( nullptr ) , mJobCancelled( false ) , mLabelingResults( nullptr ) , mUseParallelRendering( false ) , mDrawRenderingStats( false ) , mCache( nullptr ) , mResizeTimer( nullptr ) , mPreviewEffect( nullptr ) , mSnappingUtils( nullptr ) , mScaleLocked( false ) , mExpressionContextScope( tr( "Map Canvas" ) ) , mZoomDragging( false ) { mScene = new QGraphicsScene(); setScene( mScene ); setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); setMouseTracking( true ); setFocusPolicy( Qt::StrongFocus ); mResizeTimer = new QTimer( this ); mResizeTimer->setSingleShot( true ); connect( mResizeTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); // create map canvas item which will show the map mMap = new QgsMapCanvasMap( this ); // project handling connect( QgsProject::instance(), SIGNAL( readProject( const QDomDocument & ) ), this, SLOT( readProject( const QDomDocument & ) ) ); connect( QgsProject::instance(), SIGNAL( writeProject( QDomDocument & ) ), this, SLOT( writeProject( QDomDocument & ) ) ); mSettings.setFlag( QgsMapSettings::DrawEditingInfo ); mSettings.setFlag( QgsMapSettings::UseRenderingOptimization ); mSettings.setFlag( QgsMapSettings::RenderPartialOutput ); //segmentation parameters QSettings settings; double segmentationTolerance = settings.value( QStringLiteral( "/qgis/segmentationTolerance" ), "0.01745" ).toDouble(); QgsAbstractGeometry::SegmentationToleranceType toleranceType = QgsAbstractGeometry::SegmentationToleranceType( settings.value( QStringLiteral( "/qgis/segmentationToleranceType" ), 0 ).toInt() ); mSettings.setSegmentationTolerance( segmentationTolerance ); mSettings.setSegmentationToleranceType( toleranceType ); mWheelZoomFactor = settings.value( QStringLiteral( "/qgis/zoom_factor" ), 2 ).toDouble(); QSize s = viewport()->size(); mSettings.setOutputSize( s ); setSceneRect( 0, 0, s.width(), s.height() ); mScene->setSceneRect( QRectF( 0, 0, s.width(), s.height() ) ); moveCanvasContents( true ); connect( &mMapUpdateTimer, SIGNAL( timeout() ), SLOT( mapUpdateTimeout() ) ); mMapUpdateTimer.setInterval( 250 ); #ifdef Q_OS_WIN // Enable touch event on Windows. // Qt on Windows needs to be told it can take touch events or else it ignores them. grabGesture( Qt::PinchGesture ); viewport()->setAttribute( Qt::WA_AcceptTouchEvents ); #endif mPreviewEffect = new QgsPreviewEffect( this ); viewport()->setGraphicsEffect( mPreviewEffect ); QPixmap zoomPixmap = QPixmap(( const char ** )( zoom_in ) ); mZoomCursor = QCursor( zoomPixmap, 7, 7 ); setInteractive( false ); refresh(); } // QgsMapCanvas ctor
void Gui::setupUi() { onProjectNameChanged(QString(), false); setMouseTracking(true); installEventFilter(this); assert( !isFullScreen() ); //Gui::loadStyleSheet(); ///Restores position, size of the main window as well as whether it was fullscreen or not. _imp->restoreGuiGeometry(); _imp->_undoStacksGroup = new QUndoGroup; QObject::connect( _imp->_undoStacksGroup, SIGNAL(activeStackChanged(QUndoStack*)), this, SLOT(onCurrentUndoStackChanged(QUndoStack*)) ); createMenuActions(); /*CENTRAL AREA*/ //====================== _imp->_centralWidget = new QWidget(this); setCentralWidget(_imp->_centralWidget); _imp->_mainLayout = new QHBoxLayout(_imp->_centralWidget); _imp->_mainLayout->setContentsMargins(0, 0, 0, 0); _imp->_centralWidget->setLayout(_imp->_mainLayout); _imp->_leftRightSplitter = new Splitter(_imp->_centralWidget); _imp->_leftRightSplitter->setChildrenCollapsible(false); _imp->_leftRightSplitter->setObjectName(QString::fromUtf8(kMainSplitterObjectName)); _imp->_splitters.push_back(_imp->_leftRightSplitter); _imp->_leftRightSplitter->setOrientation(Qt::Horizontal); _imp->_leftRightSplitter->setContentsMargins(0, 0, 0, 0); _imp->_toolBox = new AutoHideToolBar(this, _imp->_leftRightSplitter); _imp->_toolBox->setToolButtonStyle(Qt::ToolButtonIconOnly); _imp->_toolBox->setOrientation(Qt::Vertical); _imp->_toolBox->setMaximumWidth(TO_DPIX(NATRON_TOOL_BUTTON_SIZE)); if (_imp->leftToolBarDisplayedOnHoverOnly) { _imp->refreshLeftToolBarVisibility( mapFromGlobal( QCursor::pos() ) ); } _imp->_leftRightSplitter->addWidget(_imp->_toolBox); _imp->_mainLayout->addWidget(_imp->_leftRightSplitter); _imp->createNodeGraphGui(); _imp->createCurveEditorGui(); _imp->createDopeSheetGui(); _imp->createScriptEditorGui(); _imp->createProgressPanelGui(); ///Must be absolutely called once _nodeGraphArea has been initialized. _imp->createPropertiesBinGui(); createDefaultLayoutInternal(false); _imp->_projectGui = new ProjectGui(this); _imp->_projectGui->create(_imp->_appInstance->getProject(), _imp->_layoutPropertiesBin, this); initProjectGuiKnobs(); setVisibleProjectSettingsPanel(); _imp->_aboutWindow = new AboutWindow(this, this); _imp->_aboutWindow->hide(); _imp->shortcutEditor = new ShortCutEditor(this); _imp->shortcutEditor->hide(); //the same action also clears the ofx plugins caches, they are not the same cache but are used to the same end boost::shared_ptr<Project> project = _imp->_appInstance->getProject(); QObject::connect( project.get(), SIGNAL(projectNameChanged(QString,bool)), this, SLOT(onProjectNameChanged(QString,bool)) ); boost::shared_ptr<TimeLine> timeline = project->getTimeLine(); QObject::connect( timeline.get(),SIGNAL(frameChanged(SequenceTime,int)), this,SLOT(renderViewersAndRefreshKnobsAfterTimelineTimeChange(SequenceTime,int)) ); QObject::connect( timeline.get(),SIGNAL(frameAboutToChange()), this, SLOT(onTimelineTimeAboutToChange())); /*Searches recursively for all child objects of the given object, and connects matching signals from them to slots of object that follow the following form: void on_<object name>_<signal name>(<signal parameters>); Let's assume our object has a child object of type QPushButton with the object name button1. The slot to catch the button's clicked() signal would be: void on_button1_clicked(); If object itself has a properly set object name, its own signals are also connected to its respective slots. */ QMetaObject::connectSlotsByName(this); appPTR->setOFXHostHandle(_imp->_appInstance->getOfxHostOSHandle()); } // setupUi
LauncherWidget::LauncherWidget(QWidget *parent) : BaseStyleWidget(parent) { QLabel *m_Title = new QLabel(); m_Title->setText("@launcher"); this->setObjectName("launcher"); //this->setStyleSheet("LauncherWidget { border-image:url('Webbox::Utility::PathUtil::GetCurrentExePath() + /Skin/img/abstract.jpg') 0 0 0 0 stretch stretch; border-radius: 0px; margin:0px;}"); QPalette palette; palette.setBrush(QPalette::Window, QBrush(QColor(255, 255, 255, 240)));// Qt::transparent)); this->setPalette(palette); this->setAutoFillBackground(true); m_dockWidget = new DockWidget(this); //m_dockWidget.setupUi(this); setMouseTracking(true); connect(m_dockWidget, SIGNAL(IconClicked(int)), this, SLOT(__onItemClicked(int))); QString paths[] = { "dota2.png" , "messages.png", "safari.png", "ibooks.png", "launchpad.png", "maps.png", "facetime.png", "gamecenter.png" }; m_dockWidget->AddIcon(QPixmap(Webbox::Config::AllCfg::getIconPath().append("dota2.png")), "Dota 2 CN"); //m_dockWidget->AddIcon(QPixmap(Webbox::Utility::PathUtil::GetCurrentExePath() +"/Skin/img/vancl_round.png"), "VANCL"); m_dockWidget->AddIcon(QPixmap(Webbox::Config::AllCfg::getIconPath().append("messages.png")), "iMessage"); m_dockWidget->AddIcon(QPixmap(Webbox::Config::AllCfg::getIconPath().append("safari.png")), "Safari"); m_dockWidget->AddIcon(QPixmap(Webbox::Config::AllCfg::getIconPath().append("ibooks.png")), "iBooks"); m_dockWidget->AddIcon(QPixmap(Webbox::Config::AllCfg::getIconPath().append("launchpad.png")), "LaunchPad"); m_dockWidget->AddIcon(QPixmap(Webbox::Config::AllCfg::getIconPath().append("maps.png")), "Maps"); m_dockWidget->AddIcon(QPixmap(Webbox::Config::AllCfg::getIconPath().append("facetime.png")), "FaceTime"); m_dockWidget->AddIcon(QPixmap(Webbox::Config::AllCfg::getIconPath().append("maps.png")), "Maps"); m_dockWidget->AddIcon(QPixmap(Webbox::Config::AllCfg::getIconPath().append("gamecenter.png")), "Game Center"); QGridLayout *grid_layout = new QGridLayout(); grid_layout->setContentsMargins(0,0,0,0); grid_layout->setMargin(0); //BoxDocument *doc = DocumentManager::get int idx = 0; for (int row = 0; row < 3; ++row) { for (int col = 0; col < 5; ++col) { if (idx < 8) { Webbox::Data::LaunchProperty *_property = new Webbox::Data::LaunchProperty(); _property->icon_name = paths[idx++]; _property->name_cn = "Sample App"; grid_layout->addWidget(addToolButton(80, 80, _property), row, col, Qt::AlignCenter); } else { grid_layout->addWidget(new QWidget(), row, col, Qt::AlignCenter); } } } //int idx = 0; //for (int row = 0; row < 3; ++row) // for (int col = 0; col < 5; ++col) // { // if (idx < 8) // { // /*Webbox::Data::LaunchProperty *_property = new Webbox::Data::LaunchProperty(); // QFile file(paths[idx++]); // file.open(QIODevice::ReadOnly); // QByteArray blob = file.readAll(); // _property->setIcon(blob); // _property->setNameCN("Sample App");*/ // grid_layout->addWidget(addToolButton(80, 80, _property), row, col, Qt::AlignCenter); // } // else // { // grid_layout->addWidget(new QWidget(), row, col, Qt::AlignCenter); // } // } QVBoxLayout *main_layout = new QVBoxLayout(); main_layout->setSpacing(0); main_layout->setContentsMargins(0, 0, 0, 0); main_layout->addLayout(grid_layout); main_layout->addWidget(m_dockWidget); this->setLayout(main_layout); }
Frame::Frame( QWidget* parent_ ) : QFrame( parent_ ), mImage() { mColor = QColor( 255, 0, 0 ); setMouseTracking( true ); }
void VncView::updateImage(int x, int y, int w, int h) { // kDebug(5011) << "got update" << width() << height(); m_x = x; m_y = y; m_w = w; m_h = h; if (m_horizontalFactor != 1.0 || m_verticalFactor != 1.0) { // If the view is scaled, grow the update rectangle to avoid artifacts m_x-=1; m_y-=1; m_w+=2; m_h+=2; } m_frame = vncThread.image(); if (!m_initDone) { setAttribute(Qt::WA_StaticContents); setAttribute(Qt::WA_OpaquePaintEvent); installEventFilter(this); setCursor(((m_dotCursorState == CursorOn) || m_forceLocalCursor) ? localDotCursor() : Qt::BlankCursor); setMouseTracking(true); // get mouse events even when there is no mousebutton pressed setFocusPolicy(Qt::WheelFocus); setStatus(Connected); // emit framebufferSizeChanged(m_frame.width(), m_frame.height()); emit connected(); if (m_scale) { if (parentWidget()) scaleResize(parentWidget()->width(), parentWidget()->height()); } m_initDone = true; #ifndef QTONLY if (m_hostPreferences->walletSupport()) { saveWalletPassword(vncThread.password()); } #endif } if ((y == 0 && x == 0) && (m_frame.size() != size())) { kDebug(5011) << "Updating framebuffer size"; if (m_scale) { setMaximumSize(QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX)); if (parentWidget()) scaleResize(parentWidget()->width(), parentWidget()->height()); } else { kDebug(5011) << "Resizing: " << m_frame.width() << m_frame.height(); resize(m_frame.width(), m_frame.height()); setMaximumSize(m_frame.width(), m_frame.height()); //This is a hack to force Qt to center the view in the scroll area setMinimumSize(m_frame.width(), m_frame.height()); } emit framebufferSizeChanged(m_frame.width(), m_frame.height()); } m_repaint = true; repaint(qRound(m_x * m_horizontalFactor), qRound(m_y * m_verticalFactor), qRound(m_w * m_horizontalFactor), qRound(m_h * m_verticalFactor)); m_repaint = false; }
PlaylistView::PlaylistView(QWidget* parent) : QTreeView(parent), app_(nullptr), style_(new PlaylistProxyStyle(style())), playlist_(nullptr), header_(new PlaylistHeader(Qt::Horizontal, this, this)), setting_initial_header_layout_(false), upgrading_from_qheaderview_(false), read_only_settings_(true), upgrading_from_version_(-1), background_image_type_(Default), previous_background_image_opacity_(0.0), fade_animation_(new QTimeLine(1000, this)), last_height_(-1), last_width_(-1), force_background_redraw_(false), glow_enabled_(true), currently_glowing_(false), glow_intensity_step_(0), rating_delegate_(nullptr), inhibit_autoscroll_timer_(new QTimer(this)), inhibit_autoscroll_(false), currently_autoscrolling_(false), row_height_(-1), currenttrack_play_(":currenttrack_play.png"), currenttrack_pause_(":currenttrack_pause.png"), cached_current_row_row_(-1), drop_indicator_row_(-1), drag_over_(false), dynamic_controls_(new DynamicPlaylistControls(this)) { setHeader(header_); header_->setMovable(true); setStyle(style_); setMouseTracking(true); connect(header_, SIGNAL(sectionResized(int, int, int)), SLOT(SaveGeometry())); connect(header_, SIGNAL(sectionMoved(int, int, int)), SLOT(SaveGeometry())); connect(header_, SIGNAL(sortIndicatorChanged(int, Qt::SortOrder)), SLOT(SaveGeometry())); connect(header_, SIGNAL(SectionVisibilityChanged(int, bool)), SLOT(SaveGeometry())); connect(header_, SIGNAL(sectionResized(int, int, int)), SLOT(InvalidateCachedCurrentPixmap())); connect(header_, SIGNAL(sectionMoved(int, int, int)), SLOT(InvalidateCachedCurrentPixmap())); connect(header_, SIGNAL(SectionVisibilityChanged(int, bool)), SLOT(InvalidateCachedCurrentPixmap())); connect(header_, SIGNAL(StretchEnabledChanged(bool)), SLOT(SaveSettings())); connect(header_, SIGNAL(StretchEnabledChanged(bool)), SLOT(StretchChanged(bool))); connect(header_, SIGNAL(MouseEntered()), SLOT(RatingHoverOut())); inhibit_autoscroll_timer_->setInterval(kAutoscrollGraceTimeout * 1000); inhibit_autoscroll_timer_->setSingleShot(true); connect(inhibit_autoscroll_timer_, SIGNAL(timeout()), SLOT(InhibitAutoscrollTimeout())); horizontalScrollBar()->installEventFilter(this); verticalScrollBar()->installEventFilter(this); setAlternatingRowColors(true); setAttribute(Qt::WA_MacShowFocusRect, false); dynamic_controls_->hide(); #ifdef Q_OS_DARWIN setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); #endif // For fading connect(fade_animation_, SIGNAL(valueChanged(qreal)), SLOT(FadePreviousBackgroundImage(qreal))); fade_animation_->setDirection(QTimeLine::Backward); // 1.0 -> 0.0 }
Escena::Escena(QWidget *parent) : QGLWidget(parent) , m_camara(0) , m_camara2(0) , m_esCamaraLibre(true) , m_manipularMuebles(new QAction("Muebles", this)) , m_manipularLampara(new QAction("Lampara", this)) , m_camaraLibre(new QAction("Libre", this)) , m_camaraEsquina1(new QAction("Esquina", this)) , m_camaraFrontal1(new QAction("Frontal", this)) , m_camaraLateral1(new QAction("Lateral", this)) , m_camaraCenital1(new QAction("Cenital", this)) , m_camaraEsquina2(new QAction("Esquina", this)) , m_camaraFrontal2(new QAction("Frontal", this)) , m_camaraLateral2(new QAction("Lateral", this)) , m_camaraCenital2(new QAction("Cenital", this)) , m_ambiente(new QAction("Ambiente", this)) , m_lampara(new QAction("Lampara", this)) , m_remota(new QAction("Remota", this)) , m_niebla(new QAction("Niebla", this)) , m_proyeccion(Camara::Perspectiva) { s_self = this; QAction *proyeccionOrtogonal = new QAction("Ortogonal", this); proyeccionOrtogonal->setCheckable(true); QAction *proyeccionPerspectiva = new QAction("Perspectiva", this); proyeccionPerspectiva->setCheckable(true); proyeccionPerspectiva->setChecked(true); QAction *proyeccionOblicua = new QAction("Oblicua", this); proyeccionOblicua->setCheckable(true); QActionGroup *proyeccionGroup = new QActionGroup(this); proyeccionGroup->addAction(proyeccionOrtogonal); proyeccionGroup->addAction(proyeccionPerspectiva); proyeccionGroup->addAction(proyeccionOblicua); m_ambiente->setCheckable(true); m_ambiente->setChecked(true); m_lampara->setCheckable(true); m_remota->setCheckable(true); m_niebla->setCheckable(true); connect(proyeccionOrtogonal, SIGNAL(triggered()), this, SLOT(proyeccionOrtogonal())); connect(proyeccionPerspectiva, SIGNAL(triggered()), this, SLOT(proyeccionPerspectiva())); connect(proyeccionOblicua, SIGNAL(triggered()), this, SLOT(proyeccionOblicua())); connect(m_camaraLibre, SIGNAL(triggered()), this, SLOT(camaraLibre())); connect(m_camaraEsquina1, SIGNAL(triggered()), this, SLOT(camaraEsquina1())); connect(m_camaraFrontal1, SIGNAL(triggered()), this, SLOT(camaraFrontal1())); connect(m_camaraLateral1, SIGNAL(triggered()), this, SLOT(camaraLateral1())); connect(m_camaraCenital1, SIGNAL(triggered()), this, SLOT(camaraCenital1())); connect(m_camaraEsquina2, SIGNAL(triggered()), this, SLOT(camaraEsquina2())); connect(m_camaraFrontal2, SIGNAL(triggered()), this, SLOT(camaraFrontal2())); connect(m_camaraLateral2, SIGNAL(triggered()), this, SLOT(camaraLateral2())); connect(m_camaraCenital2, SIGNAL(triggered()), this, SLOT(camaraCenital2())); connect(m_ambiente, SIGNAL(triggered()), this, SLOT(recargaLuces())); connect(m_lampara, SIGNAL(triggered()), this, SLOT(recargaLuces())); connect(m_remota, SIGNAL(triggered()), this, SLOT(recargaLuces())); connect(m_niebla, SIGNAL(triggered()), this, SLOT(recargaLuces())); setFocusPolicy(Qt::StrongFocus); setMouseTracking(true); QMenuBar *menuBar = new QMenuBar(parent); m_manipularMuebles->setCheckable(true); m_manipularMuebles->setChecked(true); m_manipularLampara->setCheckable(true); QActionGroup *actionGroup = new QActionGroup(this); actionGroup->addAction(m_manipularMuebles); actionGroup->addAction(m_manipularLampara); QMenu *controlEscena = new QMenu("Control Escena", this); controlEscena->addActions(actionGroup->actions()); menuBar->addMenu(controlEscena); QMenu *habitacion1 = new QMenu("Habitacion 1", this); habitacion1->addAction(m_camaraEsquina1); habitacion1->addAction(m_camaraFrontal1); habitacion1->addAction(m_camaraLateral1); habitacion1->addAction(m_camaraCenital1); QMenu *habitacion2 = new QMenu("Habitacion 2", this); habitacion2->addAction(m_camaraEsquina2); habitacion2->addAction(m_camaraFrontal2); habitacion2->addAction(m_camaraLateral2); habitacion2->addAction(m_camaraCenital2); QMenu *posicionCamara = new QMenu("Camara", this); posicionCamara->addAction(m_camaraLibre); posicionCamara->addMenu(habitacion1); posicionCamara->addMenu(habitacion2); menuBar->addMenu(posicionCamara); QMenu *proyeccion = new QMenu("Proyeccion", this); proyeccion->addActions(proyeccionGroup->actions()); menuBar->addMenu(proyeccion); QMenu *iluminacion = new QMenu("Iluminacion", this); iluminacion->addAction(m_ambiente); iluminacion->addAction(m_lampara); iluminacion->addAction(m_remota); iluminacion->addAction(m_niebla); menuBar->addMenu(iluminacion); static_cast<QMainWindow*>(parent)->setMenuBar(menuBar); }
DockWnd::DockWnd(DockPlugin *plugin, const char *icon, const char *text) : QWidget(NULL, "dock", WType_TopLevel | WStyle_Customize | WStyle_NoBorder | WStyle_StaysOnTop), EventReceiver(LowPriority) { #ifndef WIN32 #if !defined(QT_MACOSX_VERSION) && !defined(QT_MAC) wharfIcon = NULL; #endif #endif m_plugin = plugin; setMouseTracking(true); bNoToggle = false; bBlink = false; m_state = icon; blinkTimer = new QTimer(this); connect(blinkTimer, SIGNAL(timeout()), this, SLOT(blink())); #ifdef WIN32 m_bBalloon = false; hShell = NULL; setIcon(icon); QWidget::hide(); gDock = this; WM_DOCK = RegisterWindowMessageA("SIM dock"); if (IsWindowUnicode(winId())){ oldDockProc = (WNDPROC)SetWindowLongW(winId(), GWL_WNDPROC, (LONG)DockWindowProc); /* OSVERSIONINFOA osvi; osvi.dwOSVersionInfoSize = sizeof(osvi); GetVersionExA(&osvi); if ((osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) && (osvi.dwMajorVersion > 4)) m_bBalloon = true; */ __NOTIFYICONDATAW notifyIconData; if (m_bBalloon){ memset(¬ifyIconData, 0, sizeof(notifyIconData)); notifyIconData.cbSize = sizeof(notifyIconData); notifyIconData.uVersion = NOTIFYICON_VERSION; Shell_NotifyIconW(NIM_SETVERSION, (NOTIFYICONDATAW*)¬ifyIconData); } memset(¬ifyIconData, 0, sizeof(notifyIconData)); notifyIconData.cbSize = sizeof(notifyIconData); notifyIconData.hIcon = topData()->winIcon; notifyIconData.hWnd = winId(); notifyIconData.uCallbackMessage = WM_DOCK; notifyIconData.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP; Shell_NotifyIconW(NIM_ADD, (NOTIFYICONDATAW*)¬ifyIconData); }else{ oldDockProc = (WNDPROC)SetWindowLongA(winId(), GWL_WNDPROC, (LONG)DockWindowProc); __NOTIFYICONDATAA notifyIconData; memset(¬ifyIconData, 0, sizeof(notifyIconData)); notifyIconData.cbSize = sizeof(notifyIconData); notifyIconData.hIcon = topData()->winIcon; notifyIconData.hWnd = winId(); notifyIconData.uCallbackMessage = WM_DOCK; notifyIconData.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP; Shell_NotifyIconA(NIM_ADD, (NOTIFYICONDATAA*)¬ifyIconData); } #else setMinimumSize(22, 22); resize(22, 22); #if !defined(QT_MACOSX_VERSION) && !defined(QT_MAC) bInit = false; inTray = false; inNetTray = false; Display *dsp = x11Display(); WId win = winId(); bool bEnlightenment = false; QWidget tmp; Atom enlightenment_desktop = XInternAtom(dsp, "ENLIGHTENMENT_DESKTOP", false); WId w = tmp.winId(); Window p, r; Window *c; unsigned int nc; while (XQueryTree(dsp, w, &r, &p, &c, &nc)){ if (c && nc > 0) XFree(c); if (! p) { log(L_WARN, "No parent"); break; } unsigned char *data_ret = NULL; Atom type_ret; int i_unused; unsigned long l_unused; if ((XGetWindowProperty(dsp, p, enlightenment_desktop, 0, 1, False, XA_CARDINAL, &type_ret, &i_unused, &l_unused, &l_unused, &data_ret) == Success) && (type_ret == XA_CARDINAL)) { if (data_ret) XFree(data_ret); bEnlightenment = true; log(L_DEBUG, "Detect Enlightenment"); break; } if (p == r) break; w = p; } if (bEnlightenment){ bInit = true; resize(48, 48); setFocusPolicy(NoFocus); move(m_plugin->getDockX(), m_plugin->getDockY()); MWMHints mwm; mwm.flags = MWM_HINTS_DECORATIONS; mwm.functions = 0; mwm.decorations = 0; mwm.inputMode = 0; mwm.status = 0; Atom a = XInternAtom(dsp, "_MOTIF_WM_HINTS", False); XChangeProperty(dsp, win, a, a, 32, PropModeReplace, (unsigned char *)&mwm, sizeof(MWMHints) / 4); XStoreName(dsp, win, "SIM"); XClassHint *xch = XAllocClassHint(); xch->res_name = (char*)"SIM"; xch->res_class = (char*)"Epplet"; XSetClassHint(dsp, win, xch); XFree(xch); XSetIconName(dsp, win, "SIM"); unsigned long val = (1 << 0) /* | (1 << 9) */ ; a = XInternAtom(dsp, "_WIN_STATE", False); XChangeProperty(dsp, win, a, XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&val, 1); val = 2; a = XInternAtom(dsp, "_WIN_LAYER", False); XChangeProperty(dsp, win, a, XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&val, 1); val = (1 << 0) | (1 << 1) | (1 << 2) | (1 << 5); a = XInternAtom(dsp, "_WIN_HINTS", False); XChangeProperty(dsp, win, a, XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&val, 1); win_name = "SIM"; win_version = VERSION; win_info = ""; while (!comms_win) { ECommsSetup(dsp); sleep(1); } char s[256]; snprintf(s, sizeof(s), "set clientname %s", win_name); ECommsSend(s); snprintf(s, sizeof(s), "set version %s", win_version); ECommsSend(s); snprintf(s, sizeof(s), "set info %s", win_info); ECommsSend(s); ESYNC; set_background_properties(this); setIcon(icon); show(); return; } wharfIcon = new WharfIcon(this); #endif setBackgroundMode(X11ParentRelative); setIcon(icon); #if !defined(QT_MACOSX_VERSION) && !defined(QT_MAC) XClassHint classhint; classhint.res_name = (char*)"sim"; classhint.res_class = (char*)"Wharf"; XSetClassHint(dsp, win, &classhint); Screen *screen = XDefaultScreenOfDisplay(dsp); int screen_id = XScreenNumberOfScreen(screen); char buf[32]; snprintf(buf, sizeof(buf), "_NET_SYSTEM_TRAY_S%d", screen_id); Atom selection_atom = XInternAtom(dsp, buf, false); XGrabServer(dsp); Window manager_window = XGetSelectionOwner(dsp, selection_atom); if (manager_window != None) XSelectInput(dsp, manager_window, StructureNotifyMask); XUngrabServer(dsp); XFlush(dsp); if (manager_window != None){ inNetTray = true; if (!send_message(dsp, manager_window, SYSTEM_TRAY_REQUEST_DOCK, win, 0, 0)){ inNetTray = false; } } Atom kde_net_system_tray_window_for_atom = XInternAtom(dsp, "_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR", false); long data[1]; data[0] = 0; XChangeProperty(dsp, win, kde_net_system_tray_window_for_atom, XA_WINDOW, 32, PropModeReplace, (unsigned char*)data, 1); XWMHints *hints; hints = XGetWMHints(dsp, win); hints->initial_state = WithdrawnState; hints->icon_x = 0; hints->icon_y = 0; hints->icon_window = wharfIcon->winId(); hints->window_group = win; hints->flags = WindowGroupHint | IconWindowHint | IconPositionHint | StateHint; XSetWMHints(dsp, win, hints); XFree( hints ); Event eArgc(EventArgc); int argc = (int)eArgc.process(); Event eArgv(EventArgv); char **argv = (char**)eArgv.process(); XSetCommand(dsp, win, argv, argc); if (!inNetTray){ move(-21, -21); resize(22, 22); } #endif show(); #endif setTip(text); reset(); }
/** * Constructor. */ QG_GraphicView::QG_GraphicView(QWidget* parent, Qt::WindowFlags f, RS_Document* doc) :RS_GraphicView(parent, f) ,hScrollBar(new QG_ScrollBar(Qt::Horizontal, this)) ,vScrollBar(new QG_ScrollBar(Qt::Vertical, this)) ,layout(new QGridLayout(this)) ,gridStatus(new QLabel("-", this)) ,curCad(new QCursor(QPixmap(":ui/cur_cad_bmp.png"), CURSOR_SIZE, CURSOR_SIZE)) ,curDel(new QCursor(QPixmap(":ui/cur_del_bmp.png"), CURSOR_SIZE, CURSOR_SIZE)) ,curSelect(new QCursor(QPixmap(":ui/cur_select_bmp.png"), CURSOR_SIZE, CURSOR_SIZE)) ,curMagnifier(new QCursor(QPixmap(":ui/cur_glass_bmp.png"), CURSOR_SIZE, CURSOR_SIZE)) ,curHand(new QCursor(QPixmap(":ui/cur_hand_bmp.png"), CURSOR_SIZE, CURSOR_SIZE)) ,redrawMethod(RS2::RedrawAll) ,isSmoothScrolling(false) { RS_DEBUG->print("QG_GraphicView::QG_GraphicView().."); RS_DEBUG->print(" Setting Container.."); if (doc) { setContainer(doc); doc->setGraphicView(this); } RS_DEBUG->print(" container set."); setFactorX(4.0); setFactorY(4.0); setOffset(50, 50); setBorders(10, 10, 10, 10); if (doc) { setDefaultAction(new RS_ActionDefault(*doc, *this)); } layout->setMargin(0); layout->setSpacing(0); layout->setColumnStretch(0, 1); layout->setColumnStretch(1, 0); layout->setColumnStretch(2, 0); layout->setRowStretch(0, 1); layout->setRowStretch(1, 0); hScrollBar->setSingleStep(50); hScrollBar->setCursor(Qt::ArrowCursor); layout->addWidget(hScrollBar, 1, 0); layout->addItem(new QSpacerItem(0, hScrollBar->sizeHint().height()), 1, 0); connect(hScrollBar, SIGNAL(valueChanged(int)), this, SLOT(slotHScrolled(int))); vScrollBar->setSingleStep(50); vScrollBar->setCursor(Qt::ArrowCursor); layout->addWidget(vScrollBar, 0, 2); layout->addItem(new QSpacerItem(vScrollBar->sizeHint().width(), 0), 0, 2); connect(vScrollBar, SIGNAL(valueChanged(int)), this, SLOT(slotVScrolled(int))); // Dummy widgets for scrollbar corners: //layout->addWidget(new QWidget(this), 1, 1); //QWidget* w = new QWidget(this); //w->setEraseColor(QColor(255,0,0)); gridStatus->setAlignment(Qt::AlignRight); layout->addWidget(gridStatus, 1, 1, 1, 2); layout->addItem(new QSpacerItem(50, 0), 0, 1); setMouseTracking(true); // flickering under win: //setFocusPolicy(WheelFocus); setFocusPolicy(Qt::NoFocus); // See https://sourceforge.net/tracker/?func=detail&aid=3289298&group_id=342582&atid=1433844 (Left-mouse drag shrinks window) setAttribute(Qt::WA_NoMousePropagation); int aa = RS_SETTINGS->readNumEntry("/Appearance/Antialiasing"); set_antialiasing(aa?true:false); }
GLWidget::GLWidget(QWidget *parent) : QGLWidget(parent) { setMouseTracking(true); }
void EventLabel::mousePressEvent(QMouseEvent *e){ QString msg; msg.sprintf("(%d,%d)",e->x(),e->y()); this->setText(msg); setMouseTracking(true); //打開滑鼠追蹤,這樣mouseMoveEvent才能在不用按滑鼠時,就有作用 }
void BaseFinderView::disappear() { setEnabled(false); setMouseTracking(false); // BaseSqlModel *baseSqlModel = dynamic_cast<BaseSqlModel*>(model()); // if (baseSqlModel) baseSqlModel->clear(); }
DivePlannerGraphics::DivePlannerGraphics(QWidget* parent): QGraphicsView(parent), activeDraggedHandler(0) { fill_profile_color(); setBackgroundBrush(profile_color[BACKGROUND].at(0)); setMouseTracking(true); setScene(new QGraphicsScene()); scene()->setSceneRect(0,0,1920,1080); verticalLine = new QGraphicsLineItem( fromPercent(0, Qt::Horizontal), fromPercent(0, Qt::Vertical), fromPercent(0, Qt::Horizontal), fromPercent(100, Qt::Vertical) ); verticalLine->setPen(QPen(Qt::DotLine)); scene()->addItem(verticalLine); horizontalLine = new QGraphicsLineItem( fromPercent(0, Qt::Horizontal), fromPercent(0, Qt::Vertical), fromPercent(100, Qt::Horizontal), fromPercent(0, Qt::Vertical) ); horizontalLine->setPen(QPen(Qt::DotLine)); scene()->addItem(horizontalLine); timeLine = new Ruler(); timeLine->setMinimum(0); timeLine->setMaximum(TIME_INITIAL_MAX); timeLine->setTickInterval(10); timeLine->setColor(getColor(TIME_GRID)); timeLine->setLine( fromPercent(10, Qt::Horizontal), fromPercent(90, Qt::Vertical), fromPercent(90, Qt::Horizontal), fromPercent(90, Qt::Vertical) ); timeLine->setOrientation(Qt::Horizontal); timeLine->setTickSize(fromPercent(1, Qt::Vertical)); timeLine->setTextColor(getColor(TIME_TEXT)); timeLine->updateTicks(); scene()->addItem(timeLine); depthLine = new Ruler(); depthLine->setMinimum(0); depthLine->setMaximum(M_OR_FT(40,120)); depthLine->setTickInterval(M_OR_FT(10,30)); depthLine->setLine( fromPercent(10, Qt::Horizontal), fromPercent(10, Qt::Vertical), fromPercent(10, Qt::Horizontal), fromPercent(90, Qt::Vertical) ); depthLine->setOrientation(Qt::Vertical); depthLine->setTickSize(fromPercent(1, Qt::Horizontal)); depthLine->setColor(getColor(DEPTH_GRID)); depthLine->setTextColor(getColor(SAMPLE_DEEP)); depthLine->updateTicks(); scene()->addItem(depthLine); timeString = new QGraphicsSimpleTextItem(); timeString->setFlag(QGraphicsItem::ItemIgnoresTransformations); timeString->setBrush(profile_color[TIME_TEXT].at(0)); scene()->addItem(timeString); depthString = new QGraphicsSimpleTextItem(); depthString->setFlag(QGraphicsItem::ItemIgnoresTransformations); depthString->setBrush(profile_color[SAMPLE_DEEP].at(0)); scene()->addItem(depthString); diveBg = new QGraphicsPolygonItem(); diveBg->setPen(QPen(QBrush(),0)); scene()->addItem(diveBg); #define ADDBTN(obj, icon, text, horizontal, vertical, tooltip, value, slot) \ obj = new Button(); \ obj->setPixmap(QPixmap(icon)); \ obj->setPos(fromPercent(horizontal, Qt::Horizontal), fromPercent(vertical, Qt::Vertical)); \ obj->setToolTip(QString(tooltip.arg(value))); \ scene()->addItem(obj); \ connect(obj, SIGNAL(clicked()), this, SLOT(slot)); QString incrText; if (prefs.units.length == units::METERS) incrText = tr("10m"); else incrText = tr("30ft"); ADDBTN(plusDepth, ":plus", "" , 5, 5, tr("Increase maximum depth by %1"), incrText, increaseDepth()); ADDBTN(lessDepth, ":minimum","" , 2, 5, tr("Decreases maximum depth by %1"), incrText, decreaseDepth()); ADDBTN(plusTime, ":plus", "" , 95, 95, tr("Increase minimum time by %1"), tr("10min"), increaseTime()); ADDBTN(lessTime, ":minimum","" , 92, 95, tr("Decreases minimum time by %1"), tr("10min"), decreaseTime()); #undef ADDBTN minMinutes = TIME_INITIAL_MAX; QAction *action = NULL; #define ADD_ACTION( SHORTCUT, Slot ) \ action = new QAction(this); \ action->setShortcut( SHORTCUT ); \ action->setShortcutContext(Qt::WindowShortcut); \ addAction(action); \ connect(action, SIGNAL(triggered(bool)), this, SLOT( Slot )) ADD_ACTION(Qt::Key_Escape, keyEscAction()); ADD_ACTION(Qt::Key_Delete, keyDeleteAction()); ADD_ACTION(Qt::Key_Up, keyUpAction()); ADD_ACTION(Qt::Key_Down, keyDownAction()); ADD_ACTION(Qt::Key_Left, keyLeftAction()); ADD_ACTION(Qt::Key_Right, keyRightAction()); #undef ADD_ACTION // Prepare the stuff for the gas-choices. gasListView = new QListView(); gasListView->setWindowFlags(Qt::Popup); gasListView->setModel(GasSelectionModel::instance()); gasListView->hide(); gasListView->installEventFilter(this); connect(gasListView, SIGNAL(activated(QModelIndex)), this, SLOT(selectGas(QModelIndex))); connect(plannerModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(drawProfile())); connect(plannerModel, SIGNAL(rowsInserted(const QModelIndex&,int,int)), this, SLOT(pointInserted(const QModelIndex&, int, int))); connect(plannerModel, SIGNAL(rowsRemoved(const QModelIndex&, int, int)), this, SLOT(pointsRemoved(const QModelIndex&, int, int))); setRenderHint(QPainter::Antialiasing); }
void MembersBox::Inner::enterEventHook(QEvent *e) { setMouseTracking(true); }
PhotoView::PhotoView( PhotoDir * photoDir ) : QGraphicsView() , _photoDir( photoDir ) , _lastPhoto( 0 ) , _zoomMode( ZoomFitImage ) , _zoomFactor( 1.0 ) , _zoomIncrement( 1.2 ) , _idleTimeout( DefaultIdleTimeout ) , _actions( this ) { Q_CHECK_PTR( photoDir ); setScene( new QGraphicsScene ); _canvas = new Canvas( this ); createBorders(); QSize pannerMaxSize( qApp->desktop()->screenGeometry().size() / 6 ); _panner = new Panner( pannerMaxSize, this ); createPanels(); // // Visual tweaks // QPalette pal = palette(); pal.setColor( QPalette::Base, Qt::black ); setPalette( pal ); setFrameStyle( QFrame::NoFrame ); setVerticalScrollBarPolicy ( Qt::ScrollBarAlwaysOff ); setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); #if 0 // Some styles (e.g. Plastique) have an undesired two pixel wide focus rect // around QGraphicsView widgets. This is not what we want here, so let's // select a style that does not do this. This does not have an effect on // existing or future child widgets. And since scroll bars are turned off, // there is no other visual effect anyway. // FIXME // FIXME // FIXME setStyle( new QWindowsStyle() ); // FIXME // FIXME // FIXME #endif // Enable mouse tracking so a mouse cursor that was set invisible by an // item (e.g., Canvas) can be made visible again upon mouse movement. setMouseTracking( true ); connect( &_idleTimer, SIGNAL( timeout() ), this, SLOT ( hideCursor() ) ); _idleTimer.setSingleShot( true ); _idleTimer.start( _idleTimeout ); _cursor = viewport()->cursor(); // // Load images // _photoDir->prefetch(); if ( ! _photoDir->isEmpty() ) loadImage(); }
TransmitPAWidget::TransmitPAWidget(QWidget *parent) : QWidget(parent) , set(Settings::instance()) , m_minimumWidgetWidth(set->getMinimumWidgetWidth()) , m_minimumGroupBoxWidth(0) { setMinimumWidth(m_minimumWidgetWidth); setContentsMargins(4, 8, 4, 0); setMouseTracking(true); createGainGroup(); //createTransmitFilterGroup(); //createPTTOptionsGroup(); QBoxLayout *mainLayout = new QBoxLayout(QBoxLayout::TopToBottom, this); mainLayout->setSpacing(5); mainLayout->setMargin(0); mainLayout->addSpacing(8); QHBoxLayout *hbox1 = new QHBoxLayout(); hbox1->setSpacing(0); hbox1->setContentsMargins(4, 0, 4, 0); hbox1->addWidget(gainGroup); // QHBoxLayout *hbox2 = new QHBoxLayout(); // hbox2->setSpacing(0); // hbox2->setContentsMargins(4, 0, 4, 0); // hbox2->addWidget(transmitFilterGroup); // // QHBoxLayout *hbox3 = new QHBoxLayout(); // hbox3->setSpacing(0); // hbox3->setContentsMargins(4, 0, 4, 0); // hbox3->addWidget(pttOptionsGroup); /*QHBoxLayout *hbox4 = new QHBoxLayout(); hbox4->setSpacing(0); hbox4->setContentsMargins(4, 0, 4, 0); hbox4->addWidget(searchNetworkDeviceGroupBox); if (m_hwInterface == QSDR::NoInterfaceMode) { deviceNIGroupBox->hide(); searchNetworkDeviceGroupBox->hide(); } QHBoxLayout *hbox5 = new QHBoxLayout(); hbox5->setSpacing(0); hbox5->setContentsMargins(4, 0, 4, 0); hbox5->addWidget(source10MhzExclusiveGroup); QHBoxLayout *hbox6 = new QHBoxLayout(); hbox6->setSpacing(0); hbox6->setContentsMargins(4, 0, 4, 0); hbox6->addWidget(source122_88MhzExclusiveGroup); QHBoxLayout *hbox7 = new QHBoxLayout(); hbox7->setSpacing(0); hbox7->setContentsMargins(4, 0, 4, 0); hbox7->addWidget(numberOfReceiversGroup());*/ mainLayout->addLayout(hbox1); //mainLayout->addLayout(hbox2); //mainLayout->addLayout(hbox3); /*mainLayout->addLayout(hbox4); mainLayout->addLayout(hbox5); mainLayout->addLayout(hbox6); mainLayout->addLayout(hbox7);*/ mainLayout->addStretch(); setLayout(mainLayout); setupConnections(); }
QgsComposer::QgsComposer( QgisApp *qgis, const QString& title ) : QMainWindow() , mTitle( title ) , mUndoView( 0 ) { setupUi( this ); setWindowTitle( mTitle ); setupTheme(); connect( mButtonBox, SIGNAL( rejected() ), this, SLOT( close() ) ); QSettings settings; int size = settings.value( "/IconSize", QGIS_ICON_SIZE ).toInt(); setIconSize( QSize( size, size ) ); #ifndef Q_WS_MAC setFontSize( settings.value( "/fontPointSize", QGIS_DEFAULT_FONTSIZE ).toInt() ); #endif QToolButton* orderingToolButton = new QToolButton( this ); orderingToolButton->setPopupMode( QToolButton::InstantPopup ); orderingToolButton->setAutoRaise( true ); orderingToolButton->setToolButtonStyle( Qt::ToolButtonIconOnly ); orderingToolButton->addAction( mActionRaiseItems ); orderingToolButton->addAction( mActionLowerItems ); orderingToolButton->addAction( mActionMoveItemsToTop ); orderingToolButton->addAction( mActionMoveItemsToBottom ); orderingToolButton->setDefaultAction( mActionRaiseItems ); toolBar->addWidget( orderingToolButton ); QToolButton* alignToolButton = new QToolButton( this ); alignToolButton->setPopupMode( QToolButton::InstantPopup ); alignToolButton->setAutoRaise( true ); alignToolButton->setToolButtonStyle( Qt::ToolButtonIconOnly ); alignToolButton->addAction( mActionAlignLeft ); alignToolButton->addAction( mActionAlignHCenter ); alignToolButton->addAction( mActionAlignRight ); alignToolButton->addAction( mActionAlignTop ); alignToolButton->addAction( mActionAlignVCenter ); alignToolButton->addAction( mActionAlignBottom ); alignToolButton->setDefaultAction( mActionAlignLeft ); toolBar->addWidget( alignToolButton ); QToolButton* shapeToolButton = new QToolButton( toolBar ); shapeToolButton->setCheckable( true ); shapeToolButton->setPopupMode( QToolButton::InstantPopup ); shapeToolButton->setAutoRaise( true ); shapeToolButton->setToolButtonStyle( Qt::ToolButtonIconOnly ); shapeToolButton->addAction( mActionAddRectangle ); shapeToolButton->addAction( mActionAddTriangle ); shapeToolButton->addAction( mActionAddEllipse ); shapeToolButton->setDefaultAction( mActionAddEllipse ); toolBar->insertWidget( mActionAddArrow, shapeToolButton ); QActionGroup* toggleActionGroup = new QActionGroup( this ); toggleActionGroup->addAction( mActionMoveItemContent ); toggleActionGroup->addAction( mActionAddNewMap ); toggleActionGroup->addAction( mActionAddNewLabel ); toggleActionGroup->addAction( mActionAddNewLegend ); toggleActionGroup->addAction( mActionAddNewScalebar ); toggleActionGroup->addAction( mActionAddImage ); toggleActionGroup->addAction( mActionSelectMoveItem ); toggleActionGroup->addAction( mActionAddRectangle ); toggleActionGroup->addAction( mActionAddTriangle ); toggleActionGroup->addAction( mActionAddEllipse ); toggleActionGroup->addAction( mActionAddArrow ); toggleActionGroup->addAction( mActionAddTable ); toggleActionGroup->addAction( mActionAddHtml ); toggleActionGroup->setExclusive( true ); mActionAddNewMap->setCheckable( true ); mActionAddNewLabel->setCheckable( true ); mActionAddNewLegend->setCheckable( true ); mActionSelectMoveItem->setCheckable( true ); mActionAddNewScalebar->setCheckable( true ); mActionAddImage->setCheckable( true ); mActionMoveItemContent->setCheckable( true ); mActionAddArrow->setCheckable( true ); #ifdef Q_WS_MAC QMenu *appMenu = menuBar()->addMenu( tr( "QGIS" ) ); appMenu->addAction( QgisApp::instance()->actionAbout() ); appMenu->addAction( QgisApp::instance()->actionOptions() ); #endif QMenu *fileMenu = menuBar()->addMenu( tr( "File" ) ); fileMenu->addAction( mActionLoadFromTemplate ); fileMenu->addAction( mActionSaveAsTemplate ); fileMenu->addSeparator(); fileMenu->addAction( mActionExportAsImage ); fileMenu->addAction( mActionExportAsPDF ); fileMenu->addAction( mActionExportAsSVG ); fileMenu->addSeparator(); fileMenu->addAction( mActionPageSetup ); fileMenu->addAction( mActionPrint ); fileMenu->addSeparator(); fileMenu->addAction( mActionQuit ); QObject::connect( mActionQuit, SIGNAL( triggered() ), this, SLOT( close() ) ); QMenu *viewMenu = menuBar()->addMenu( tr( "View" ) ); viewMenu->addAction( mActionZoomIn ); viewMenu->addAction( mActionZoomOut ); viewMenu->addAction( mActionZoomAll ); viewMenu->addSeparator(); viewMenu->addAction( mActionRefreshView ); // Panel and toolbar submenus mPanelMenu = new QMenu( tr( "Panels" ), this ); mPanelMenu->setObjectName( "mPanelMenu" ); mToolbarMenu = new QMenu( tr( "Toolbars" ), this ); mToolbarMenu->setObjectName( "mToolbarMenu" ); viewMenu->addSeparator(); viewMenu->addMenu( mPanelMenu ); viewMenu->addMenu( mToolbarMenu ); // toolBar already exists, add other widgets as they are created mToolbarMenu->addAction( toolBar->toggleViewAction() ); QMenu *layoutMenu = menuBar()->addMenu( tr( "Layout" ) ); layoutMenu->addAction( mActionUndo ); layoutMenu->addAction( mActionRedo ); layoutMenu->addSeparator(); layoutMenu->addAction( mActionAddNewMap ); layoutMenu->addAction( mActionAddNewLabel ); layoutMenu->addAction( mActionAddNewScalebar ); layoutMenu->addAction( mActionAddNewLegend ); layoutMenu->addAction( mActionAddImage ); layoutMenu->addAction( mActionSelectMoveItem ); layoutMenu->addAction( mActionMoveItemContent ); layoutMenu->addAction( mActionAddArrow ); layoutMenu->addAction( mActionAddTable ); layoutMenu->addSeparator(); layoutMenu->addAction( mActionGroupItems ); layoutMenu->addAction( mActionUngroupItems ); layoutMenu->addAction( mActionRaiseItems ); layoutMenu->addAction( mActionLowerItems ); layoutMenu->addAction( mActionMoveItemsToTop ); layoutMenu->addAction( mActionMoveItemsToBottom ); #ifdef Q_WS_MAC #ifndef Q_WS_MAC64 /* assertion failure in NSMenuItem setSubmenu (Qt 4.5.0-snapshot-20080830) */ menuBar()->addMenu( QgisApp::instance()->windowMenu() ); menuBar()->addMenu( QgisApp::instance()->helpMenu() ); #endif #endif mQgis = qgis; mFirstTime = true; // Create action to select this window mWindowAction = new QAction( windowTitle(), this ); connect( mWindowAction, SIGNAL( triggered() ), this, SLOT( activate() ) ); QgsDebugMsg( "entered." ); setMouseTracking( true ); mViewFrame->setMouseTracking( true ); //create composer view mView = new QgsComposerView( mViewFrame ); //init undo/redo buttons mComposition = new QgsComposition( mQgis->mapCanvas()->mapRenderer() ); mActionUndo->setEnabled( false ); mActionRedo->setEnabled( false ); if ( mComposition->undoStack() ) { connect( mComposition->undoStack(), SIGNAL( canUndoChanged( bool ) ), mActionUndo, SLOT( setEnabled( bool ) ) ); connect( mComposition->undoStack(), SIGNAL( canRedoChanged( bool ) ), mActionRedo, SLOT( setEnabled( bool ) ) ); }
WzMainWindow::WzMainWindow(QSize resolution, const QGLFormat &format, QWidget *parent) : QtGameWidget(resolution, format, parent) { myself = this; notReadyToPaint = true; tickCount.start(); std::fill_n(cursors, CURSOR_MAX, nullptr); setAutoFillBackground(false); setAutoBufferSwap(false); setMouseTracking(true); // Mac apps typically don't have window icons unless document-based. #if !defined(WZ_OS_MAC) setWindowIcon(QIcon(QPixmap::fromImage(loadQImage("images/warzone2100.png", "PNG")))); #endif setWindowTitle(PACKAGE_NAME); loadCursor(CURSOR_EMBARK, "images/intfac/image_cursor_embark.png"); loadCursor(CURSOR_DEST, "images/intfac/image_cursor_dest.png"); loadCursor(CURSOR_DEFAULT, "images/intfac/image_cursor_default.png"); loadCursor(CURSOR_BUILD, "images/intfac/image_cursor_build.png"); loadCursor(CURSOR_SCOUT, "images/intfac/image_cursor_scout.png"); loadCursor(CURSOR_DISEMBARK, "images/intfac/image_cursor_disembark.png"); loadCursor(CURSOR_ATTACK, "images/intfac/image_cursor_attack.png"); loadCursor(CURSOR_GUARD, "images/intfac/image_cursor_guard.png"); loadCursor(CURSOR_FIX, "images/intfac/image_cursor_fix.png"); loadCursor(CURSOR_SELECT, "images/intfac/image_cursor_select.png"); // loadCursor(CURSOR_REPAIR, 64, 160, buffer); // FIX ME: This IS in infac.img, but the define is MIA loadCursor(CURSOR_SEEKREPAIR, "images/intfac/image_cursor_repair.png"); // FIX ME: This is NOT in infac.img! loadCursor(CURSOR_PICKUP, "images/intfac/image_cursor_pickup.png"); loadCursor(CURSOR_NOTPOSSIBLE, "images/intfac/image_cursor_notpos.png"); loadCursor(CURSOR_MOVE, "images/intfac/image_cursor_move.png"); loadCursor(CURSOR_LOCKON, "images/intfac/image_cursor_lockon.png"); // loadCursor(CURSOR_ECM, 224, 160, buffer); // FIX ME: Not defined yet! loadCursor(CURSOR_JAM, "images/intfac/image_cursor_ecm.png"); // FIX ME: This is NOT in infac.img, and is using IMAGE CURSOR ECM ? loadCursor(CURSOR_ATTACH, "images/intfac/image_cursor_attach.png"); loadCursor(CURSOR_BRIDGE, "images/intfac/image_cursor_bridge.png"); loadCursor(CURSOR_BOMB, "images/intfac/image_cursor_bomb.png"); // Reused (unused) cursors cursors[CURSOR_ARROW] = new QCursor(Qt::ArrowCursor); cursors[CURSOR_MENU] = new QCursor(Qt::ArrowCursor); cursors[CURSOR_BOMB] = new QCursor(Qt::ArrowCursor); cursors[CURSOR_EDGEOFMAP] = new QCursor(Qt::ArrowCursor); cursors[CURSOR_SIGHT] = new QCursor(Qt::ArrowCursor); cursors[CURSOR_TARGET] = new QCursor(Qt::ArrowCursor); cursors[CURSOR_UARROW] = new QCursor(Qt::SizeVerCursor); cursors[CURSOR_DARROW] = new QCursor(Qt::SizeVerCursor); cursors[CURSOR_LARROW] = new QCursor(Qt::SizeHorCursor); cursors[CURSOR_RARROW] = new QCursor(Qt::SizeHorCursor); // Fonts regularFont.setFamily("DejaVu Sans"); regularFont.setPixelSize(12); boldFont.setFamily("DejaVu Sans"); boldFont.setPixelSize(21); boldFont.setWeight(QFont::DemiBold); smallFont.setFamily("DejaVu Sans"); smallFont.setPixelSize(9); // Want focusOutEvent messages. setFocusPolicy(Qt::StrongFocus); // set radix character (again) to the period (".") setlocale(LC_NUMERIC, "C"); #if !defined(WZ_OS_MAC) // Want áéíóú inputMethodEvent messages. setAttribute(Qt::WA_InputMethodEnabled, true); #else // But not on the Mac (no ALT+H on US Extended Keyboards) setAttribute(Qt::WA_InputMethodEnabled, false); #endif }