/*! \internal Adds \a item to the grid. The items are added from top-left to bottom-right. */ void ColorPickerPopup::insertColor(const QColor &col, const QString &text, int index) { // Don't add colors that we have already. ColorPickerItem *existingItem = find(col); ColorPickerItem *lastSelectedItem = find(lastSelected()); if (existingItem) { if (lastSelectedItem && existingItem != lastSelectedItem) lastSelectedItem->setSelected(false); existingItem->setFocus(); existingItem->setSelected(true); return; } ColorPickerItem *item = new ColorPickerItem(this, col, text, this); if (lastSelectedItem) { lastSelectedItem->setSelected(false); } else { item->setSelected(true); lastSel = col; } item->setFocus(); connect(item, SIGNAL(selected()), SLOT(updateSelected())); if (index == -1) index = items.count(); items.insert((unsigned int)index, item); regenerateGrid(); update(); }
void Inner::mouseReleaseEvent(QMouseEvent *e) { _previewTimer.stop(); auto pressed = std::exchange(_pressed, -1); auto activated = ClickHandler::unpressed(); if (_previewShown) { _previewShown = false; return; } _lastMousePos = e->globalPos(); updateSelected(); if (_selected < 0 || _selected != pressed || !activated) { return; } if (dynamic_cast<InlineBots::Layout::SendClickHandler*>(activated.get())) { int row = _selected / MatrixRowShift, column = _selected % MatrixRowShift; selectInlineResult(row, column); } else { App::activateClickHandler(activated, e->button()); } }
QAction *Menu::addAction(QAction *action, const style::icon *icon, const style::icon *iconOver) { connect(action, SIGNAL(changed()), this, SLOT(actionChanged())); _actions.push_back(action); auto createData = [icon, iconOver, action] { auto data = ActionData(); data.icon = icon; data.iconOver = iconOver ? iconOver : icon; data.hasSubmenu = (action->menu() != nullptr); return data; }; _actionsData.push_back(createData()); auto newWidth = qMax(width(), _st.widthMin); newWidth = processAction(action, _actions.size() - 1, newWidth); auto newHeight = height() + (action->isSeparator() ? _separatorHeight : _itemHeight); resize(_forceWidth ? _forceWidth : newWidth, newHeight); if (_resizedCallback) { _resizedCallback(); } updateSelected(QCursor::pos()); update(); return action; }
ProfileWidget::ProfileWidget(QWidget *parent, const PeerData *peer) : QWidget(parent), _inner(this, &_scroll, peer), _scroll(this, st::setScroll), _showing(false) { _scroll.setWidget(&_inner); _scroll.move(0, 0); _inner.move(0, 0); _scroll.show(); connect(&_scroll, SIGNAL(scrolled()), &_inner, SLOT(updateSelected())); connect(&_scroll, SIGNAL(scrolled()), this, SLOT(onScroll())); }
bool ProfileInner::event(QEvent *e) { if (e->type() == QEvent::MouseMove) { QMouseEvent *ev = dynamic_cast<QMouseEvent*>(e); if (ev) { _lastPos = ev->globalPos(); updateSelected(); } } return QWidget::event(e); }
void Inner::mousePressEvent(QMouseEvent *e) { if (e->button() != Qt::LeftButton) { return; } _lastMousePos = e->globalPos(); updateSelected(); _pressed = _selected; ClickHandler::pressed(); _previewTimer.start(QApplication::startDragTime()); }
void CurveEditInstance::renderComponentsSelected(RenderableCollector& collector, const VolumeTest& volume, const Matrix4& localToWorld) const { updateSelected(); if(!m_selectedRender.empty()) { collector.highlightPrimitives(false); collector.SetState(_shaders.selectedShader, RenderableCollector::eWireframeOnly); collector.SetState(_shaders.selectedShader, RenderableCollector::eFullMaterials); collector.addRenderable(m_selectedRender, localToWorld); } }
LRESULT Win32Tabber::wndProc( HWND hwnd,UINT msg,WPARAM wp,LPARAM lp,WNDPROC proc ){ NMHDR *nm; switch( msg ){ case WM_NOTIFY: nm=(NMHDR*)lp; if( nm->code==TCN_SELCHANGE ){ int index=updateSelected(); emit( BBEvent::GADGET_ACTION,index ); return 0; } } return CallWindowProc(proc,hwnd,msg,wp,lp); }
void Menu::handleMouseMove(QPoint globalPosition) { auto inner = rect().marginsRemoved(QMargins(0, _st.skip, 0, _st.skip)); auto localPosition = mapFromGlobal(globalPosition); if (inner.contains(localPosition)) { _mouseSelection = true; updateSelected(globalPosition); } else { clearMouseSelection(); if (_mouseMoveDelegate) { _mouseMoveDelegate(globalPosition); } } }
void PopupMenu::mouseMoveEvent(QMouseEvent *e) { if (_inner.marginsRemoved(QMargins(0, _st.skip, 0, _st.skip)).contains(mapFromGlobal(e->globalPos()))) { _mouseSelection = true; _mouse = e->globalPos(); updateSelected(); } else { if (_mouseSelection && _childMenuIndex < 0) { _mouseSelection = false; setSelected(-1); } if (_parent) { _parent->mouseMoveEvent(e); } } }
void Win32Tabber::insert( int index,BBString *item,int icon ){ if( !items()->size() ){ SendMessage( _tabber.hwnd(),TCM_DELETEALLITEMS,0,0 ); } TCITEM t={0}; t.mask=TCIF_TEXT; t.pszText=(char*)item->c_str(); if( iconStrip() && icon>=0 ){ t.mask|=TCIF_IMAGE; t.iImage=icon; } SendMessage( _tabber.hwnd(),TCM_INSERTITEM,index,(LPARAM)&t ); BBTabber::insert( index,item,icon ); updateSelected(); }
void ProfileInner::mousePressEvent(QMouseEvent *e) { _lastPos = e->globalPos(); updateSelected(); if (_kickOver) { _kickDown = _kickOver; update(); } else if (_selectedRow >= 0 && _selectedRow < _participants.size()) { App::main()->showPeerProfile(_participants[_selectedRow]); } else if (QRect(_left, st::profilePadding.top(), st::setPhotoSize, st::setPhotoSize).contains(e->pos())) { if (_photoLink) { _photoLink->onClick(e->button()); } else if (_peerChat && !_peerChat->forbidden) { onUpdatePhoto(); } } }
bool CheckBoxList::eventFilter(QObject *object, QEvent * event) { if ((event->type() == QEvent::MouseButtonPress) && (!popupopen)) { popupopen = true; return true; } if((event->type() == QEvent::MouseButtonRelease) && (object==view()->viewport()) && popupopen) { updateSelected(highli); repaint(); popupopen = true; return true; } return QComboBox::eventFilter(object,event); }
void ProfileInner::mouseMoveEvent(QMouseEvent *e) { _lastPos = e->globalPos(); updateSelected(); bool photoOver = QRect(_left, st::profilePadding.top(), st::setPhotoSize, st::setPhotoSize).contains(e->pos()); if (photoOver != _photoOver) { _photoOver = photoOver; if (!_photoLink && _peerChat && !_peerChat->forbidden) { a_photo.start(_photoOver ? 1 : 0); anim::start(this); } } if (!_photoLink && (!_peerChat || _peerChat->forbidden)) { setCursor((_kickOver || _kickDown) ? style::cur_pointer : style::cur_default); } else { setCursor((_kickOver || _kickDown || _photoOver) ? style::cur_pointer : style::cur_default); } }
RectTool::RectTool(AddingType type, Canvas *canvas) : Tool(canvas), d(new Data) { d->layerController = canvas->findChild<LayerUIController *>(); d->updateManager = new CanvasUpdateManager(this); connect(d->updateManager, SIGNAL(updateTilesRequested(QPointSet)), this, SIGNAL(requestUpdate(QPointSet))); // set modes d->addingType = type; if (d->addingType == NoAdding) d->selectingMode = SelectImmediately; else d->selectingMode = SelectLater; // create graphics items { auto group = new QGraphicsItemGroup(); group->setHandlesChildEvents(false); setGraphicsItem(group); { auto frame = new FrameGraphicsItem(group); d->frameItem = frame; } } addHandle(Top | Left, 1); addHandle(Top | Right, 1); addHandle(Bottom | Left, 1); addHandle(Bottom | Right, 1); addHandle(Top, 0); addHandle(Bottom, 0); addHandle(Left, 0); addHandle(Right, 0); connect(layerScene(), SIGNAL(selectionChanged(QList<LayerConstRef>,QList<LayerConstRef>)), this, SLOT(updateSelected())); connect(layerScene(), SIGNAL(layerChanged(LayerConstRef)), this, SLOT(updateLayer(LayerConstRef))); connect(canvas, SIGNAL(transformsChanged(SP<const CanvasTransforms>)), this, SLOT(updateGraphicsItems())); updateSelected(); }
void processAligns(struct sqlConnection *conn, struct gbSelect* select, struct gbStatusTbl* statusTbl, char* tmpDir) /* load the alignments. select->orgCat determines if native and/or xeno * are loaded */ { struct gbUpdate* update; gbVerbEnter(3, "processing alignments"); gbAlignDataInit(tmpDir, &gOptions, conn); /* load alignments for updates that are new and actually had sequences align */ for (update = select->release->updates; update != NULL; update = update->next) { if (updateSelected(update, select)) processUpdateAligns(conn, select, update, statusTbl); } select->update = NULL; gbAlignDataSetStatus(statusTbl); gbVerbLeave(3, "processing alignments"); if ((gOptions.flags & DBLOAD_INITIAL) == 0) loadAligns(conn); }
void MaxInviteBox::leaveEvent(QEvent *e) { updateSelected(QCursor::pos()); }
void MaxInviteBox::mouseMoveEvent(QMouseEvent *e) { updateSelected(e->globalPos()); }
void PlayerWidget::mouseMoveEvent(QMouseEvent *e) { _lastMousePos = e->globalPos(); updateSelected(); }
Transfers::Transfers(QWidget* _p, const char* _n) : QWidget(_p) { QVBoxLayout *MainBox = new QVBoxLayout(this); MainBox->setMargin(0); MainBox->setSpacing(0); transferSplitter = new QSplitter(this); MainBox->addWidget(transferSplitter); downloadsWidget = new QWidget(transferSplitter); uploadsWidget = new QWidget(transferSplitter); transferSplitter->setOrientation(Qt::Vertical); if (museeq->settings()->value("saveTransfersLayout", false).toBool()) { QString optionName = "transferSplitter_Layout"; transferSplitter->restoreState(museeq->settings()->value(optionName).toByteArray()); } // Downloads QVBoxLayout *downloadVbox = new QVBoxLayout(downloadsWidget); downloadVbox->setMargin(0); downloadVbox->setSpacing(3); QHBoxLayout *downloadHbox = new QHBoxLayout; downloadVbox->addLayout(downloadHbox); QLabel * downloadsLabel = new QLabel(tr("Downloads:"), downloadsWidget); downloadsLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); downloadHbox->addWidget(downloadsLabel); mDownrate = new QSpinBox(downloadsWidget); mDownrate->setMaximum(9999); downloadHbox->addWidget(mDownrate); QLabel * downrateLabel = new QLabel(tr("KiB/s"), downloadsWidget); downloadHbox->addWidget(downrateLabel); connect(mDownrate, SIGNAL(valueChanged(const QString&)), SLOT(setDownrate(const QString&))); connect(museeq, SIGNAL(configChanged(const QString&, const QString&, const QString&)), SLOT(slotConfigChanged(const QString&, const QString&, const QString&))); QFrame* sep = new QFrame(downloadsWidget); downloadHbox->addWidget(sep); sep->setFrameShape(QFrame::VLine); sep->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred); mDownslots = new QSpinBox(downloadsWidget); downloadHbox->addWidget(mDownslots); QLabel * downslotsLabel = new QLabel(tr("slots"), downloadsWidget); downloadHbox->addWidget(downslotsLabel); connect(mDownslots, SIGNAL(valueChanged(const QString&)), SLOT(setDownslots(const QString&))); connect(museeq, SIGNAL(configChanged(const QString&, const QString&, const QString&)), SLOT(slotConfigChanged(const QString&, const QString&, const QString&))); QFrame* sep2 = new QFrame(downloadsWidget); downloadHbox->addWidget(sep2); sep2->setFrameShape(QFrame::VLine); sep2->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred); mGroupDownloads = new QCheckBox(tr("Group by user"), downloadsWidget); downloadHbox->addWidget(mGroupDownloads); connect(mGroupDownloads, SIGNAL(toggled(bool)), SLOT(groupDownloadsSet(bool))); mDownloads = new TransferListView(true, downloadsWidget, "downloads"); downloadVbox->addWidget(mDownloads); mDownloads->setAcceptDrops(true); connect(museeq, SIGNAL(downloadUpdated(const NTransfer&)), mDownloads, SLOT(update(const NTransfer&))); connect(museeq, SIGNAL(downloadRemoved(const QString&, const QString&)), mDownloads, SLOT(remove(const QString&, const QString&))); connect(mDownloads, SIGNAL(dropSlsk(const QList<QUrl>&)), SLOT(dropSlsk(const QList<QUrl>&))); // Uploads QVBoxLayout *uploadVbox = new QVBoxLayout(uploadsWidget); uploadVbox->setMargin(0); uploadVbox->setSpacing(3); QHBoxLayout *uploadHbox = new QHBoxLayout; uploadVbox->addLayout(uploadHbox); uploadHbox->setSpacing(5); QLabel * uploadsLabel = new QLabel(tr("Uploads:")); uploadsLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); uploadHbox->addWidget(uploadsLabel); mUprate = new QSpinBox(uploadsWidget); mUprate->setMaximum(9999); uploadHbox->addWidget(mUprate); QLabel * uprateLabel = new QLabel(tr("KiB/s"), uploadsWidget); uploadHbox->addWidget(uprateLabel); connect(mUprate, SIGNAL(valueChanged(const QString&)), SLOT(setUprate(const QString&))); connect(museeq, SIGNAL(configChanged(const QString&, const QString&, const QString&)), SLOT(slotConfigChanged(const QString&, const QString&, const QString&))); QFrame* sep3 = new QFrame(uploadsWidget); uploadHbox->addWidget(sep3); sep3->setFrameShape(QFrame::VLine); sep3->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred); mUpslots = new QSpinBox(uploadsWidget); uploadHbox->addWidget(mUpslots); QLabel * upslotsLabel = new QLabel(tr("slots"), uploadsWidget); uploadHbox->addWidget(upslotsLabel); connect(mUpslots, SIGNAL(valueChanged(const QString&)), SLOT(setUpslots(const QString&))); connect(museeq, SIGNAL(configChanged(const QString&, const QString&, const QString&)), SLOT(slotConfigChanged(const QString&, const QString&, const QString&))); QFrame* sep4 = new QFrame(uploadsWidget); uploadHbox->addWidget(sep4); sep4->setFrameShape(QFrame::VLine); sep4->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred); mGroupUploads = new QCheckBox(tr("Group by user"), uploadsWidget); uploadHbox->addWidget(mGroupUploads); connect(mGroupUploads, SIGNAL(toggled(bool)), SLOT(groupUploadsSet(bool))); mUploads = new TransferListView(false, uploadsWidget, "uploads"); uploadVbox->addWidget(mUploads); connect(museeq, SIGNAL(uploadUpdated(const NTransfer&)), mUploads, SLOT(update(const NTransfer&))); connect(museeq, SIGNAL(uploadRemoved(const QString&, const QString&)), mUploads, SLOT(remove(const QString&, const QString&))); mTransferMenu = new QMenu(this); ActionRetry = new QAction(tr("Retry"), this); connect(ActionRetry, SIGNAL(triggered()), this, SLOT(retrySelected())); mTransferMenu->addAction(ActionRetry); ActionCheckPosition = new QAction(tr("Check place"), this); connect(ActionCheckPosition, SIGNAL(triggered()), this, SLOT(updateSelected())); mTransferMenu->addAction(ActionCheckPosition); ActionAbort = new QAction(tr("Abort"), this); connect(ActionAbort, SIGNAL(triggered()), this, SLOT(abortSelected())); mTransferMenu->addAction(ActionAbort); ActionMessageDownloading = new QAction(tr("Message downloading users"), this); connect(ActionMessageDownloading, SIGNAL(triggered()), this, SLOT(messageDownloadingUsers())); mTransferMenu->addAction(ActionMessageDownloading); mClearMenu = mTransferMenu->addMenu(tr("Clear")); ActionClearSelected = new QAction(tr("Selected"), this); connect(ActionClearSelected, SIGNAL(triggered()), this, SLOT(clearSelected())); mClearMenu->addAction(ActionClearSelected); mClearMenu->addSeparator(); ActionClearFinished = new QAction(tr("Finished"), this); connect(ActionClearFinished, SIGNAL(triggered()), this, SLOT(clearFinished())); mClearMenu->addAction(ActionClearFinished); ActionClearAborted = new QAction(tr("Aborted"), this); connect(ActionClearAborted, SIGNAL(triggered()), this, SLOT(clearAborted())); mClearMenu->addAction(ActionClearAborted); ActionClearAwaiting = new QAction(tr("Offline"), this); connect(ActionClearAwaiting, SIGNAL(triggered()), this, SLOT(clearAwaiting())); mClearMenu->addAction(ActionClearAwaiting); ActionClearCruft = new QAction(tr("Cruft"), this); connect(ActionClearCruft, SIGNAL(triggered()), this, SLOT(clearCruft())); mClearMenu->addAction(ActionClearCruft); ActionClearFinishedAborted = new QAction(tr("Finished / aborted"), this); connect(ActionClearFinishedAborted, SIGNAL(triggered()), this, SLOT(clearFinishedAborted())); mClearMenu->addAction(ActionClearFinishedAborted); ActionClearQueued = new QAction(tr("Queued"), this); connect(ActionClearQueued, SIGNAL(triggered()), this, SLOT(clearQueued())); mClearMenu->addAction(ActionClearQueued); mTransferMenu->addSeparator(); mUsersMenu = mTransferMenu->addMenu(tr("Users")); connect(mDownloads, SIGNAL(customContextMenuRequested(const QPoint&)), SLOT(popupDownloads(const QPoint&))); connect(mUploads, SIGNAL(customContextMenuRequested(const QPoint&)), SLOT(popupUploads(const QPoint&))); connect(museeq, SIGNAL(transfersSorting(bool)), SLOT(setSorting(bool))); mUpGroupingChanging = mDownGroupingChanging = true; groupDownloads(museeq->settings()->value("groupDownloads", false).toBool()); groupUploads(museeq->settings()->value("groupUploads", false).toBool()); mUpGroupingChanging = mDownGroupingChanging = false; connect(museeq, SIGNAL(closingMuseeq()), this, SLOT(onClosingMuseeq())); }
void OverlayEditorScene::contextMenuEvent(QGraphicsSceneContextMenuEvent *e) { QGraphicsScene::contextMenuEvent(e); if (e->isAccepted()) return; if (! e->widget()) return; QGraphicsPixmapItem *item = childAt(e->scenePos()); QMenu qm(e->widget()); QMenu *qmLayout = qm.addMenu(tr("Layout preset")); QAction *qaLayoutLargeAvatar = qmLayout->addAction(tr("Large square avatar")); QAction *qaLayoutText = qmLayout->addAction(tr("Avatar and Name")); QMenu *qmTrans = qm.addMenu(tr("User Opacity")); QActionGroup *qagUser = new QActionGroup(&qm); QAction *userOpacity[8]; for (int i=0;i<8;++i) { qreal o = (i + 1) / 8.0; userOpacity[i] = new QAction(tr("%1%").arg(o * 100.0f, 0, 'f', 1), qagUser); userOpacity[i]->setCheckable(true); userOpacity[i]->setData(o); if (qFuzzyCompare(qgiGroup->opacity(), o)) userOpacity[i]->setChecked(true); qmTrans->addAction(userOpacity[i]); } QAction *color = NULL; QAction *fontAction = NULL; QAction *objectOpacity[8]; for (int i=0;i<8;++i) objectOpacity[i] = NULL; QAction *boxpen[4] = { NULL, NULL, NULL, NULL}; QAction *boxpad[4] = { NULL, NULL, NULL, NULL}; QAction *boxpencolor = NULL; QAction *boxfillcolor = NULL; QAction *align[6]; for (int i=0;i<6;++i) align[i] = NULL; if (item) { qm.addSeparator(); QMenu *qmObjTrans = qm.addMenu(tr("Object Opacity")); QActionGroup *qagObject = new QActionGroup(&qm); for (int i=0;i<8;++i) { qreal o = i + 1 / 8.0; objectOpacity[i] = new QAction(tr("%1%").arg(o * 100.0f, 0, 'f', 1), qagObject); objectOpacity[i]->setCheckable(true); objectOpacity[i]->setData(o); if (qFuzzyCompare(item->opacity(), o)) objectOpacity[i]->setChecked(true); qmObjTrans->addAction(objectOpacity[i]); } QMenu *qmObjAlign = qm.addMenu(tr("Alignment")); Qt::Alignment a; if (item == qgpiAvatar) a = os.qaAvatar; else if (item == qgpiChannel) a = os.qaChannel; else if (item == qgpiMuted) a = os.qaMutedDeafened; else a = os.qaUserName; align[0] = qmObjAlign->addAction(tr("Left")); align[0]->setCheckable(true); align[0]->setData(Qt::AlignLeft); if (a & Qt::AlignLeft) align[0]->setChecked(true); align[1] = qmObjAlign->addAction(tr("Center")); align[1]->setCheckable(true); align[1]->setData(Qt::AlignHCenter); if (a & Qt::AlignHCenter) align[1]->setChecked(true); align[2] = qmObjAlign->addAction(tr("Right")); align[2]->setCheckable(true); align[2]->setData(Qt::AlignRight); if (a & Qt::AlignRight) align[2]->setChecked(true); qmObjAlign->addSeparator(); align[3] = qmObjAlign->addAction(tr("Top")); align[3]->setCheckable(true); align[3]->setData(Qt::AlignTop); if (a & Qt::AlignTop) align[3]->setChecked(true); align[4] = qmObjAlign->addAction(tr("Center")); align[4]->setCheckable(true); align[4]->setData(Qt::AlignVCenter); if (a & Qt::AlignVCenter) align[4]->setChecked(true); align[5] = qmObjAlign->addAction(tr("Bottom")); align[5]->setCheckable(true); align[5]->setData(Qt::AlignBottom); if (a & Qt::AlignBottom) align[5]->setChecked(true); if ((item != qgpiAvatar) && (item != qgpiMuted)) { color = qm.addAction(tr("Color...")); fontAction = qm.addAction(tr("Font...")); } } if (qgpiBox->isVisible()) { qm.addSeparator(); QMenu *qmBox = qm.addMenu(tr("Bounding box")); QMenu *qmPen = qmBox->addMenu(tr("Pen width")); QMenu *qmPad = qmBox->addMenu(tr("Padding")); boxpencolor = qmBox->addAction(tr("Pen color")); boxfillcolor = qmBox->addAction(tr("Fill color")); QActionGroup *qagPen = new QActionGroup(qmPen); QActionGroup *qagPad = new QActionGroup(qmPad); for (int i=0;i<4;++i) { qreal v = (i) ? powf(2.0f, static_cast<float>(-10 + i)) : 0.0f; boxpen[i] = new QAction(QString::number(i), qagPen); boxpen[i]->setData(v); boxpen[i]->setCheckable(true); if (qFuzzyCompare(os.fBoxPenWidth, v)) boxpen[i]->setChecked(true); qmPen->addAction(boxpen[i]); boxpad[i] = new QAction(QString::number(i), qagPad); boxpad[i]->setData(v); boxpad[i]->setCheckable(true); if (qFuzzyCompare(os.fBoxPad, v)) boxpad[i]->setChecked(true); qmPad->addAction(boxpad[i]); } } QAction *act = qm.exec(e->screenPos()); if (! act) return; for (int i=0;i<8;++i) { if (userOpacity[i] == act) { float o = static_cast<float>(act->data().toReal()); os.fUser[tsColor] = o; qgiGroup->setOpacity(o); } } for (int i=0;i<8;++i) { if (objectOpacity[i] == act) { qreal o = act->data().toReal(); if (item == qgpiMuted) os.fMutedDeafened = o; else if (item == qgpiAvatar) os.fAvatar = o; else if (item == qgpiChannel) os.fChannel = o; else if (item == qgpiName) os.fUserName = o; item->setOpacity(o); } } for (int i=0;i<4;++i) { if (boxpen[i] == act) { os.fBoxPenWidth = act->data().toReal(); moveBox(); } else if (boxpad[i] == act) { os.fBoxPad = act->data().toReal(); moveBox(); } } for (int i=0;i<6;++i) { if (align[i] == act) { Qt::Alignment *aptr; if (item == qgpiAvatar) aptr = & os.qaAvatar; else if (item == qgpiChannel) aptr = & os.qaChannel; else if (item == qgpiMuted) aptr = & os.qaMutedDeafened; else aptr = & os.qaUserName; Qt::Alignment a = static_cast<Qt::Alignment>(act->data().toInt()); if (a & Qt::AlignHorizontal_Mask) { *aptr = (*aptr & ~Qt::AlignHorizontal_Mask) | a; } else { *aptr = (*aptr & ~Qt::AlignVertical_Mask) | a; } updateSelected(); } } if (act == boxpencolor) { QColor qc = QColorDialog::getColor(os.qcBoxPen, e->widget(), tr("Pick pen color"), QColorDialog::DontUseNativeDialog | QColorDialog::ShowAlphaChannel); if (! qc.isValid()) return; os.qcBoxPen = qc; moveBox(); } else if (act == boxfillcolor) { QColor qc = QColorDialog::getColor(os.qcBoxFill, e->widget(), tr("Pick fill color"), QColorDialog::DontUseNativeDialog | QColorDialog::ShowAlphaChannel); if (! qc.isValid()) return; os.qcBoxFill = qc; moveBox(); } else if (act == color) { QColor *col = NULL; if (item == qgpiChannel) col = & os.qcChannel; else if (item == qgpiName) col = & os.qcUserName[tsColor]; if (! col) return; QColor qc = QColorDialog::getColor(*col, e->widget(), tr("Pick color"), QColorDialog::DontUseNativeDialog); if (! qc.isValid()) return; qc.setAlpha(255); if (qc == *col) return; *col = qc; updateSelected(); } else if (act == fontAction) { QFont *fontptr = (item == qgpiChannel) ? &os.qfChannel : &os.qfUserName; qgpiSelected = NULL; qgriSelected->hide(); // QFontDialog doesn't really like graphics view. At all. QFontDialog qfd; qfd.setOptions(QFontDialog::DontUseNativeDialog); qfd.setCurrentFont(*fontptr); qfd.setWindowTitle(tr("Pick font")); int ret; if (g.ocIntercept) { QGraphicsProxyWidget *qgpw = new QGraphicsProxyWidget(NULL, Qt::Window); qgpw->setWidget(&qfd); addItem(qgpw); qgpw->setZValue(3.0f); qgpw->setPanelModality(QGraphicsItem::PanelModal); qgpw->setPos(- qgpw->boundingRect().width() / 2.0f, - qgpw->boundingRect().height() / 2.0f); qgpw->show(); ret = qfd.exec(); qgpw->hide(); qgpw->setWidget(NULL); delete qgpw; } else { Qt::WindowFlags wf = g.mw->windowFlags(); if (wf.testFlag(Qt::WindowStaysOnTopHint)) qfd.setWindowFlags(qfd.windowFlags() | Qt::WindowStaysOnTopHint); ret = qfd.exec(); } if (! ret) return; *fontptr = qfd.selectedFont(); resync(); } else if (act == qaLayoutLargeAvatar) { os.setPreset(OverlaySettings::LargeSquareAvatar); resync(); } else if (act == qaLayoutText) { os.setPreset(OverlaySettings::AvatarAndName); resync(); } }
void Inner::mouseMoveEvent(QMouseEvent *e) { _lastMousePos = e->globalPos(); updateSelected(); }
void ProfileInner::leaveEvent(QEvent *e) { setMouseTracking(false); _lastPos = QCursor::pos(); updateSelected(); return TWidget::leaveEvent(e); }
void PlayerWidget::leaveEvent(QEvent *e) { _lastMousePos = QCursor::pos(); updateSelected(); }
void ProfileInner::leaveToChildEvent(QEvent *e) { _lastPos = QCursor::pos(); updateSelected(); return TWidget::leaveToChildEvent(e); }
void Inner::enterFromChildEvent(QEvent *e, QWidget *child) { _lastMousePos = QCursor::pos(); updateSelected(); }