bool ButtonMenuLayout::onAnimationEnd(const EventArgs& e) { auto args = static_cast<const AnimationEventArgs &>(e); if (args.instance == instHideAnimation) doHide(); else if (args.instance == instShowAnimation) container->enable(); return true; }
LightGotoLineWidget::LightGotoLineWidget(QWidget* parent) : QWidget( parent) { ui.setupUi(this); connect( ui.closeButton, SIGNAL( clicked() ), this, SLOT( doHide() ) ); connect( ui.gotoButton, SIGNAL( clicked() ), this, SLOT( gotoLine() ) ); ui.gotoButton->setShortcut(Qt::Key_Return); ui.gotoButton->setToolTip("Return"); ui.closeButton->setShortcut(Qt::Key_Escape); ui.closeButton->setToolTip("Escape"); }
FindWidget::FindWidget(QWidget* parent) : QWidget( parent) { ui.setupUi(this); connect(ui.findButton, SIGNAL( clicked() ), this, SLOT( doFind() ) ); connect(ui.findBackwardButton, SIGNAL( clicked() ), this, SLOT( doFindInvert() ) ); connect(ui.closeButton, SIGNAL( clicked() ), this, SLOT( doHide() ) ); ui.findButton->setShortcut(Qt::Key_Return); ui.findBackwardButton->setShortcut(Qt::Key_Return | Qt::SHIFT); ui.closeButton->setShortcut(Qt::Key_Escape); }
void WheelBrowserScreen::clicked(const QString &name) { if(name.startsWith("Folder/")) { moveToView(name); } else { QContent app(name,false); app.execute(); doHide(); } }
uint32 Tooltip::doHide(uint32 UNUSED(oldInterval)) { Common::StackLock lock(_mutex); if (!_visible) return 0; _visible = false; TimerMan.removeTimer(_timerShow); doHide(); return 0; }
void Tooltip::hide() { Common::StackLock lock(_mutex); if (!_visible) return; _visible = false; TimerMan.removeTimer(_timerHide); TimerMan.removeTimer(_timerShow); doHide(); }
void TimedMessageBox::startAnimation() { QMutexLocker locker(&mutex); count++; QRect dr= QApplication::desktop()->rect(); this->move(dr.right()-this->size().width(),dr.bottom()); QPropertyAnimation *ani = new QPropertyAnimation(this,"pos",this); connect(ani,SIGNAL(finished()),ani,SLOT(deleteLater())); connect(ani,SIGNAL(finished()),this,SLOT(doHide())); ani->setStartValue(this->pos()); ani->setEndValue(QPoint(this->pos().x(),dr.bottom()-this->frameGeometry().height()-this->frameGeometry().height()*count)); ani->setDuration(500); ani->start(); }
ContactWidgetItem::ContactWidgetItem(const Akonadi::Item & item, QGraphicsWidget * parent) : Plasma::Frame(parent), m_edit(0), m_show(false), m_info(false) { m_item = item; KABC::Addressee addressee = m_item.payload<KABC::Addressee>(); m_addressee = new KABC::Addressee(addressee); m_mainLayout = new QGraphicsLinearLayout(Qt::Vertical, this); m_mainLayout->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); m_edit = new Plasma::PushButton(this); m_edit->setMinimumHeight(25); m_edit->setMaximumHeight(25); m_edit->setText(i18n("Edit")); m_edit->hide(); m_icon = new Plasma::IconWidget(this); m_icon->setOrientation(Qt::Horizontal); m_icon->setDrawBackground(true); m_icon->setMinimumSize(250, 50); m_icon->setMaximumHeight(50); setContactIcon(); m_mainLayout->addItem(m_icon); setFrameShadow(Plasma::Frame::Raised); setLayout(m_mainLayout); QGraphicsOpacityEffect * effect = new QGraphicsOpacityEffect(this); effect->setOpacity(1); setGraphicsEffect(effect); m_animation = new QPropertyAnimation(effect, "opacity", effect); m_animation->setStartValue(0); m_animation->setEndValue(1); m_animation->setDuration(300); connect(m_animation, SIGNAL(finished()), this, SLOT(doHide())); connect(m_icon, SIGNAL(clicked()), SLOT(showContactInfo())); connect(m_edit, SIGNAL(clicked()), SLOT(editContact())); }
LightFindWidget::LightFindWidget(QWidget* parent) : QWidget( parent) { ui.setupUi(this); connect(ui.findButton, SIGNAL( clicked() ), this, SLOT( doFind() ) ); connect(ui.closeButton, SIGNAL( clicked() ), this, SLOT( doHide() ) ); ui.findButton->setShortcut(Qt::Key_Return); ui.findButton->setToolTip("Return"); ui.closeButton->setShortcut(Qt::Key_Escape); ui.closeButton->setToolTip("Escape"); ui.moreButton->setCheckable(true); ui.moreButton->setAutoDefault(false); connect(ui.moreButton, SIGNAL(toggled(bool)), this, SLOT(expand(bool))); ui.checkRegExp->setChecked( false ); ui.checkSelection->setChecked( false ); connect(ui.checkSelection, SIGNAL(toggled(bool)), this, SLOT(updateSelection(bool))); ui.extension->hide(); updateGeometry(); }
/*! \reimp */ void WheelBrowserScreen::keyPressEvent(QKeyEvent *e) { if(e->key() == Qt::Key_Back || e->key() == Qt::Key_Down) { m_views.removeLast(); if(m_views.count()) { QString toview = m_views.last(); QPixmapWheelData data = getData(toview); if(data.count()) { m_wheel->moveToWheel(data); } } else { doHide(); } e->accept(); } else { QAbstractBrowserScreen::keyPressEvent(e); } }
QvisMessageWindow::QvisMessageWindow(MessageAttributes *msgAttr, const QString &captionString) : QvisWindowBase(captionString, Qt::Dialog), Observer(msgAttr) { setWindowRole("message"); preserveInformation = false; enableWarningPopups = true; // Create the central widget and the top layout. QWidget *central = new QWidget( this ); setCentralWidget( central ); QVBoxLayout *topLayout = new QVBoxLayout(central); topLayout->setMargin(10); // Create a multi line edit to display the message text. messageText = new QTextEdit(central); messageText->setWordWrapMode(QTextOption::WordWrap); messageText->setReadOnly(true); messageText->setMinimumWidth(3 * fontMetrics().width("Closed the compute " "engine on host sunburn.llnl.gov. ") / 2); messageText->setMinimumHeight(8 * fontMetrics().lineSpacing()); severityLabel = new QLabel(tr("Message"), central); severityLabel->setBuddy(messageText); QFont f("helvetica", 18); f.setBold(true); severityLabel->setFont(f); topLayout->addWidget(severityLabel); topLayout->addSpacing(10); topLayout->addWidget(messageText); topLayout->addSpacing(10); QHBoxLayout *buttonLayout = new QHBoxLayout(0); topLayout->addLayout(buttonLayout); // Create a button to hide the window. QPushButton *dismissButton = new QPushButton(tr("Dismiss"), central); buttonLayout->addStretch(10); buttonLayout->addWidget(dismissButton); connect(dismissButton, SIGNAL(clicked()), this, SLOT(doHide())); }
void KviTextIconWindow::keyPressEvent(QKeyEvent * e) { switch(e->key()) { case Qt::Key_Space: case Qt::Key_Return: { cellSelected(m_pTable->currentRow(), m_pTable->currentColumn()); } break; case Qt::Key_Tab: //avoid the text edit field to move to the icon cells using tab break; break; case Qt::Key_Escape: doHide(); break; break; default: QWidget::keyPressEvent(e); break; } }
void ButtonMenuLayout::hide() { if (!container->isVisible()) return; if (hideAnimation) { if (instHideAnimation->isRunning()) return; container->disable(); instHideAnimation->start(); } else { doHide(); } if (parentLayout) { parentLayout->show(); } }
void KviTextIconWindow::cellSelected(int row, int column) { if(!m_pTable->cellWidget(row, column)) return; QString szItem(m_pTable->cellWidget(row, column)->toolTip()); szItem.append(' '); if(m_bAltMode) szItem.prepend(KviControlCodes::Icon); if(m_pOwner->inherits("KviInputEditor")) ((KviInputEditor *)m_pOwner)->insertIconCode(szItem); else if(m_pOwner->inherits("KviInput")) ((KviInput *)m_pOwner)->insertText(szItem); else if(m_pOwner->inherits("QLineEdit")) { QString szTmp = ((QLineEdit *)m_pOwner)->text(); szTmp.insert(((QLineEdit *)m_pOwner)->cursorPosition(),szItem); ((QLineEdit *)m_pOwner)->setText(szTmp); ((QLineEdit *)m_pOwner)->setCursorPosition(((QLineEdit *)m_pOwner)->cursorPosition() + szItem.length()); } doHide(); }
void Tooltip::updatePosition() { if (_empty) return; Common::StackLock lock(_mutex); float pX, pY, pZ; if (!getParentPosition(pX, pY, pZ)) { _offscreen = true; doHide(); return; } else { _offscreen = false; doShow(); } // Set bubble position const bool hasBubble = _showBubble && _bubble; const float bubbleWidth = hasBubble ? (_bubble->getWidth () - 30.0) : _width; const float bubbleHeight = hasBubble ? (_bubble->getHeight() - 8.0) : _height; const float bubbleWantX = pX + _x - (bubbleWidth / 2.0); const float bubbleRight = bubbleWantX + bubbleWidth + 15.0f; const float maxX = _detectEdge ? GfxMan.getScreenWidth() / 2.0 : 0.0; const float overX = _detectEdge ? MAX(0.0f, bubbleRight - maxX) : 0.0; const float bubbleX = bubbleWantX - overX; const float bubbleY = pY + _y; const float bubbleZ = pZ + _z; if (hasBubble) _bubble->setPosition(floorf(bubbleX), floorf(bubbleY), floorf(bubbleZ)); // Set portrait position const bool hasPortrait = _showPortrait && _portrait; const float portraitWidth = hasPortrait ? _portrait->getWidth () : 0.0; const float portraitHeight = hasPortrait ? _portrait->getHeight() : 0.0; const float portraitBorderY = (bubbleHeight - portraitHeight) / 2.0; const float portraitX = bubbleX + 5.0; const float portraitY = bubbleY - bubbleHeight + portraitBorderY + 1.0; const float portraitZ = bubbleZ - 1.0; if (hasPortrait) _portrait->setPosition(floorf(portraitX), floorf(portraitY), floorf(portraitZ)); // Set text position const float portraitSpacerWidth = portraitWidth + (_portrait ? 10.0 : 0.0); const float bubbleTextWidth = bubbleWidth - portraitSpacerWidth; const float textHeight = _lines.size() * _lineHeight + (_lines.size() - 1) * _lineSpacing; const float textBorderY = (bubbleHeight - textHeight) / 2.0; const float textBottomX = bubbleX + portraitSpacerWidth; const float textBottomY = bubbleY - textBorderY + 1.0; const float textBottomZ = bubbleZ - 1.0; float textY = textBottomY; for (std::vector<Line>::reverse_iterator l = _lines.rbegin(); l != _lines.rend(); ++l) { if (l->text) { const float textWidth = l->text->getWidth(); const float textBorderX = (bubbleTextWidth - textWidth) * _align; const float textX = textBottomX + textBorderX; const float lineY = textY - l->text->getHeight(); l->text->setPosition(floorf(textX), floorf(lineY), floorf(textBottomZ)); } textY -= (_lineHeight + _lineSpacing); } }
void Tooltip::hide() { TimerMan.removeTimer(_timer); _visible = false; doHide(); }
void DesktopIndicatorHandler::disable() { // hide shell icon without waiting for thread execution... doHide(); PostThreadMessage( g_DesktopIndicatorThread, WM_DESKTOPINDICATOR, disableCode, (LPARAM) this ); }
void KviTextIconWindow::ownerDead() { m_pOwner = 0; doHide(); }