bool UIControllerSetting::eventFilter( QObject* object, QEvent* event ) { if ( event->type() == QEvent::Paint ) { QToolButton* tb = qobject_cast<QToolButton*>( object ); if ( tb ) { if ( tb->isChecked() ) { QStylePainter sp( tb ); QStyleOptionToolButton options; options.initFrom( tb ); options.arrowType = Qt::NoArrow; options.features = QStyleOptionToolButton::None; options.icon = tb->icon(); options.iconSize = tb->iconSize(); options.state = QStyle::State_Enabled | QStyle::State_HasFocus | QStyle::State_On | QStyle::State_AutoRaise; sp.drawComplexControl( QStyle::CC_ToolButton, options ); return true; } } } return false; }
void AMSelectablePeriodicTableView::onClicked(int id) { QToolButton *clicked = button(id); if (clicked->isChecked()) table_->selectElement(id); else table_->deselectElement(id); }
void Task::setOpen(bool o) { QToolButton *b = m_header->toggleButton(); if (b->isChecked() == o) { b->setChecked(o); if (b->arrowType()!=Qt::NoArrow) { if (o) { b->setArrowType(Qt::UpArrow); } else { b->setArrowType(Qt::DownArrow); } } QwwTaskPanel *tp = parent() ? qobject_cast<QwwTaskPanel*>(parent()->parent()->parent()->parent()) : 0; if(tp && tp->isAnimated()){ if (m_animator.state()!=QTimeLine::NotRunning) { m_animator.setDirection(m_animator.direction()==QTimeLine::Forward ? QTimeLine::Backward : QTimeLine::Forward); } else { m_animBody = new QWidget; m_animBody->installEventFilter(this); #ifndef Q_WS_WIN m_animBody->setEnabled(false); #endif m_animBody->setAttribute(Qt::WA_NoSystemBackground, true); body()->ensurePolished(); QSize s = QLayout::closestAcceptableSize(body(), body()->sizeHint()).expandedTo(QSize(width(), 0)); body()->resize(s); body()->setAttribute(Qt::WA_WState_ExplicitShowHide, true); body()->setAttribute(Qt::WA_WState_Hidden, false); m_animpix = QPixmap::grabWidget(body()); body()->setAttribute(Qt::WA_WState_Hidden, true); if (o) { m_animator.setDirection(QTimeLine::Forward); m_animator.setFrameRange(0, s.height()); } else { m_animator.setDirection(QTimeLine::Backward); m_animator.setFrameRange(0, m_body->height()); } m_body->hide(); QVBoxLayout *l = (QVBoxLayout*)layout(); l->addWidget(m_animBody); m_animBody->show(); m_animator.start(); } } else { if(o) m_body->show(); else m_body->hide(); } } }
virtual QVariant value () const { return m_tool_button->isChecked (); }
void AdvancedImageWidget::toolButtonReleased(QWidget * /*button*/) { if (mUi->panButton->isChecked()) { mCurrentToolClass = PAN_TOOL; mUi->widget->setCursor(Qt::OpenHandCursor); return; } if (mUi->selectZoomButton->isChecked()) { mCurrentToolClass = ZOOM_SELECT_TOOL; mUi->widget->setCursor(Qt::ArrowCursor); return; } if (mUi->infoButton->isChecked()) { mCurrentToolClass = INFO_TOOL; mUi->widget->setCursor(Qt::CrossCursor); return; } mUi->widget->setMouseTracking(mCurrentToolClass == INFO_TOOL); for (int i = 0; i < (int)mSelectionButtons.size(); i++) { QToolButton *button = mSelectionButtons.at(i).button; if (!button->isChecked()) continue; mUi->widget->setCursor(Qt::ArrowCursor); mCurrentSelectionButton = mSelectionButtons.at(i).id; mCurrentToolClass = RECT_SELECTION_TOOLS; return; } for (int i = 0; i < (int)mPointButtons.size(); i++) { QToolButton *button = mPointButtons.at(i).button; if (!button->isChecked()) continue; mCurrentToolClass = POINT_SELECTION_TOOLS; mUi->widget->setCursor(Qt::CrossCursor); mCurrentPointButton = mPointButtons.at(i).id; return; } for (int i = 0; i < (int)mLineButtons.size(); i++) { QToolButton *button = mLineButtons.at(i).button; if (!button->isChecked()) continue; mCurrentToolClass = LINE_SELECTION_TOOLS; mUi->widget->setCursor(Qt::CrossCursor); mCurrentLineButton = mLineButtons.at(i).id; return; } //printf("tools [%c%c%c%c]\n", isInSelectArea ? 'X' : 'O', isInPan ? 'X' : 'O', isInSelectZoom ? 'X' : 'O', isInInfo ? 'X' : 'O'); }
bool MsgEdit::sendMessage(Message *msg) { if (m_retry.msg){ delete m_retry.msg; m_retry.msg = NULL; } if (m_msg){ delete msg; if (EventMessageCancel(m_msg).process()) m_msg = NULL; stopSend(false); return false; } bool bClose = true; if (CorePlugin::instance()->getContainerMode()){ bClose = false; Command cmd; cmd->id = CmdSendClose; cmd->param = this; EventCommandWidget eWidget(cmd); eWidget.process(); QToolButton *btnClose = qobject_cast<QToolButton*>(eWidget.widget()); if (btnClose) bClose = btnClose->isChecked(); } CorePlugin::instance()->setValue("CloseSend", bClose); Contact *contact = getContacts()->contact(m_userWnd->id()); if (contact){ SIM::PropertyHubPtr data = contact->getUserData("translit"); if (!data.isNull() && data->value("Translit").toBool()) msg->setFlags(msg->getFlags() | MESSAGE_TRANSLIT); } msg->setFlags(msg->getFlags() | m_flags); m_flags = 0; if (m_userWnd->m_list){ if( !m_userWnd->m_list->isHaveSelected() ) return false; multiply = m_userWnd->m_list->selected(); msg->setContact( multiply.first() ); multiply.pop_front(); msg->setClient(NULL); if( multiply.count() > 0 ) msg->setFlags(msg->getFlags() | MESSAGE_MULTIPLY); }else if (!m_resource.isEmpty()){ void *data = NULL; Client *c = client(data, true, false, msg->contact(), true); if (c){ QString resources = c->resources(data); while (!resources.isEmpty()){ QString res = getToken(resources, ';'); getToken(res, ','); if (m_resource == res){ msg->setResource(m_resource); break; } } } } editLostFocus(); Command cmd; cmd->id = CmdSend; cmd->text = I18N_NOOP("Cancel"); cmd->icon = "cancel"; cmd->flags = BTN_PICT; cmd->param = this; EventCommandChange(cmd).process(); m_msg = msg; return send(); }