void MigrateDialog::ask() { QPushButton *btn = cancelButton(); QPoint p = btn->mapToGlobal(QPoint(0, 0)); QRect rc(p.x(), p.y(), btn->width(), btn->height()); BalloonMsg::ask(NULL, i18n("Cancel convert?"), this, SLOT(cancel(void*)), NULL, &rc); }
void TextShow::startSearch(int parag, int index) { QString to_find_string = srchdialog->getText(); if (doSearch(to_find_string, srchdialog->case_sensitive(), (!srchdialog->get_direction()), ¶g, &index)){ setSelection(parag, index, parag, index + to_find_string.length()); setCursorPosition(parag, index + to_find_string.length()); ensureCursorVisible(); return; } if (!srchdialog->isVisible()){ QApplication::beep(); return; } QStringList btns; btns.append(i18n("&Yes")); btns.append(i18n("&No")); QObjectList *l = srchdialog->queryList("QPushButton"); QObjectListIt it( *l ); if (it.current() == 0){ delete l; QApplication::beep(); return; } QPushButton *btnOK = static_cast<QPushButton*>(it.current()); delete l; QRect rc = btnOK->rect(); rc.moveTopLeft(btnOK->mapToGlobal(rc.topLeft())); BalloonMsg *msg = new BalloonMsg(!srchdialog->get_direction() ? i18n("End of document reached.\nContinue from the beginning?") : i18n("Beginning of document reached.\nContinue from the end?"), rc, btns, this); connect(msg, SIGNAL(action(int)), this, SLOT(searchAgain(int))); msg->show(); }
void CWizDocumentView::on_infoButton_clicked() { if (!m_info) { m_info = new CWizNoteInfoForm(m_dbMgr, topLevelWidget()); } m_info->setDocument(m_web->document()); QPushButton* btn = m_title->infoButton(); QRect rc = btn->geometry(); QPoint pt = btn->mapToGlobal(QPoint(rc.width() / 2, rc.height())); m_info->showAtPoint(pt); }
void CWizDocumentView::on_tagsButton_clicked() { if (!m_tags) { m_tags = new CWizTagListWidget(m_dbMgr, topLevelWidget()); } m_tags->setDocument(m_web->document()); QPushButton* btn = m_title->tagsButton(); QRect rc = btn->geometry(); QPoint pt = btn->mapToGlobal(QPoint(rc.width() / 2, rc.height())); m_tags->showAtPoint(pt); }
void CWizDocumentView::on_attachmentButton_clicked() { if (!m_attachments) { m_attachments = new CWizAttachmentListWidget(m_app, topLevelWidget()); } m_attachments->setDocument(m_web->document()); QPushButton* btn = m_title->attachmentButton(); QRect rc = btn->geometry(); QPoint pt = btn->mapToGlobal(QPoint(rc.width() / 2, rc.height())); m_attachments->showAtPoint(pt); }
void QtPropertyDataDavaKeyedArcive::AddKeyedArchiveField() { QPushButton* btn = dynamic_cast<QPushButton*>(QObject::sender()); if(NULL != curArchive && NULL != btn) { KeyedArchiveItemWidget *w = new KeyedArchiveItemWidget(curArchive, lastAddedType); QObject::connect(w, SIGNAL(ValueReady(const DAVA::String&, const DAVA::VariantType&)), this, SLOT(NewKeyedArchiveFieldReady(const DAVA::String&, const DAVA::VariantType&))); w->show(); QRect bRect = btn->geometry(); QPoint bPos = btn->mapToGlobal(btn->mapFromParent(bRect.topLeft())); QRect wRect = w->geometry(); QPoint wPos = QPoint(bPos.x() - wRect.width() + bRect.width(), bPos.y() + bRect.height()); w->move(wPos); }
void CSVWidget::ColorPickerPopup::mousePressEvent(QMouseEvent *event) { QPushButton *button = qobject_cast<QPushButton *>(parentWidget()); if (button != NULL) { QStyleOptionButton option; option.init(button); QRect buttonRect = option.rect; buttonRect.moveTo(button->mapToGlobal(buttonRect.topLeft())); // If the mouse is pressed above the pop-up parent, // the pop-up will be hidden and the pressed signal won't be repeated for the parent if (buttonRect.contains(event->globalPos()) || buttonRect.contains(event->pos())) { setAttribute(Qt::WA_NoMouseReplay); } } QFrame::mousePressEvent(event); }