void ContactWidget::init() { _ignoreSignals = false; _titleSingular = tr("Contact"); _titlePlural = tr("Contacts"); _query = "SELECT cntct.*, crmacct_name " "FROM cntct() LEFT OUTER JOIN crmacct ON (cntct_crmacct_id = crmacct_id) "; _layoutDone = false; _minimalLayout = false; _searchAcctId = -1; _list = new QPushButton(tr("..."), this); _list->setObjectName("_list"); _list->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); #ifndef Q_WS_MAC _list->setMaximumWidth(25); #else _list->setMinimumWidth(60); _list->setMinimumHeight(32); #endif _grid->removeWidget(_label); // will be reinserted _grid->removeWidget(_description); delete _description; _description = 0; _grid->setMargin(0); _grid->setSpacing(2); _nameBox = new QHBoxLayout; _nameBox->setSpacing(2); _initialsBox = new QHBoxLayout; _initialsBox->setSpacing(2); _titleBox = new QHBoxLayout; _titleBox->setSpacing(2); _change = new XLineEdit(this); _numberLit = new QLabel(tr("Number:"), this); _numberLit->setObjectName("_numberLit"); _number = new XLineEdit(this, "_number"); _change->hide(); _number->hide(); _numberLit->hide(); _nameLit = new QLabel(tr("Name:"), this); _nameLit->setObjectName("_nameLit"); _honorific = new XComboBox(this, "_honorific"); _first = new XLineEdit(this, "_first"); _middle = new XLineEdit(this, "_middle"); _middle->setFixedWidth(20); _last = new XLineEdit(this, "_last"); _suffix = new XLineEdit(this, "_suffix"); _suffix->setFixedWidth(30); _initialsLit = new QLabel(tr("Initials:"), this); _initialsLit->setObjectName("_initialsLit"); _initials = new XLineEdit(this, "_initials"); _initials->setFixedWidth(_initials->size().width() / 3); _titleLit = new QLabel(tr("Job Title:"), this); _titleLit->setObjectName("_titleLit"); _title = new XLineEdit(this, "_title"); _mapper = new XDataWidgetMapper(this); //_nameBox->addWidget(_nameLit, 0); _nameBox->addWidget(_honorific, 0); _nameBox->addWidget(_first, 1); _nameBox->addWidget(_middle, 0); _nameBox->addWidget(_last, 2); _nameBox->addWidget(_suffix, 0); _nameBox->addWidget(_list, 0, Qt::AlignRight); //_initialsBox->addWidget(_initialsLit, 0); _initialsBox->addWidget(_initials, 0); _initialsBox->addStretch(0); //_titleBox->addWidget(_titleLit, 0); _titleBox->addWidget(_title, 2); _buttonBox = new QGridLayout; _crmAcct = new CRMAcctCluster(this, "_crmAcct"); _active = new QCheckBox(tr("Active"), this); _active->setObjectName("_active"); _owner = new UsernameCluster(this, "_owner"); _buttonBox->addWidget(_crmAcct, 0, 1, Qt::AlignTop); _buttonBox->addWidget(_owner, 0, 2, Qt::AlignTop); QRegExp rx("^([0-9a-z]+[-._+&])*[0-9a-z]+@([-0-9a-z]+[.])+[a-z]{2,6}$"); QValidator *validator = new QRegExpValidator(rx, this); _phoneLit = new QLabel(tr("Voice:"), this); _phoneLit->setObjectName("_phoneLit"); _phone = new XLineEdit(this, "_phone"); _phone2Lit = new QLabel(tr("Alternate:"), this); _phone2Lit->setObjectName("_phone2Lit"); _phone2 = new XLineEdit(this, "_phone2"); _faxLit = new QLabel(tr("Fax:"), this); _faxLit->setObjectName("_faxLit"); _fax = new XLineEdit(this, "_fax"); _emailLit = new QLabel(tr("E-Mail:"), this); _emailLit->setObjectName("_emailLit"); _email = new XComboBox(this, "_email"); _email->setEditable(true); _email->setValidator(validator); _email->lineEdit()->installEventFilter(this); _webaddrLit = new QLabel(tr("Web:"), this); _webaddrLit->setObjectName("_webaddrLit"); _webaddr = new XLineEdit(this, "_webaddr"); _address = new AddressCluster(this, "_address"); //So we can manipulate just the line edit QLineEdit* emailEdit = _email->lineEdit(); #if defined Q_OS_MAC _honorific->setMinimumHeight(26); _first->setMinimumHeight(22); _middle->setMinimumHeight(22); _last->setMinimumHeight(22); _suffix->setMinimumHeight(22); _phone->setMinimumWidth(140); _crmAcct->setMinimumHeight(72); #endif QPalette p = _email->palette(); p.setColor(QPalette::Text, Qt::blue); emailEdit->setPalette(p); _webaddr->setPalette(p); QFont newFont = _email->font(); newFont.setUnderline(TRUE); emailEdit->setFont(newFont); _webaddr->setFont(newFont); _numberLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _label->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); _nameLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _titleLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _phoneLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _phone2Lit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _faxLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _emailLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _initialsLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _webaddrLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _honorific->setEditable(true); _honorific->setType(XComboBox::Honorifics); _crmAcct->setLabel(tr("CRM Account:")); _owner->setLabel(tr("Owner:")); layout(); connect(_list, SIGNAL(clicked()), this, SLOT(sEllipses())); connect(_honorific, SIGNAL(newID(int)), this, SIGNAL(changed())); connect(_first, SIGNAL(textChanged(const QString&)), this, SIGNAL(changed())); connect(_middle, SIGNAL(textChanged(const QString&)), this, SIGNAL(changed())); connect(_last, SIGNAL(textChanged(const QString&)), this, SIGNAL(changed())); connect(_suffix, SIGNAL(textChanged(const QString&)), this, SIGNAL(changed())); connect(_initials, SIGNAL(textChanged(const QString&)), this, SIGNAL(changed())); connect(_crmAcct, SIGNAL(newId(int)), this, SIGNAL(changed())); connect(_title, SIGNAL(textChanged(const QString&)), this, SIGNAL(changed())); connect(_phone, SIGNAL(textChanged(const QString&)), this, SIGNAL(changed())); connect(_phone2, SIGNAL(textChanged(const QString&)), this, SIGNAL(changed())); connect(_fax, SIGNAL(textChanged(const QString&)), this, SIGNAL(changed())); connect(_email, SIGNAL(textChanged(const QString&)), this, SIGNAL(changed())); connect(_webaddr, SIGNAL(textChanged(const QString&)), this, SIGNAL(changed())); connect(_address, SIGNAL(changed()), this, SIGNAL(changed())); connect(this, SIGNAL(changed()), this, SLOT(setChanged())); connect(_honorific, SIGNAL(newID(int)), this, SLOT(sCheck())); connect(_first, SIGNAL(lostFocus()), this, SLOT(sCheck())); connect(_middle, SIGNAL(lostFocus()), this, SLOT(sCheck())); connect(_last, SIGNAL(lostFocus()), this, SLOT(sCheck())); connect(_suffix, SIGNAL(lostFocus()), this, SLOT(sCheck())); connect(_initials, SIGNAL(lostFocus()), this, SLOT(sCheck())); connect(_crmAcct, SIGNAL(newId(int)), this, SLOT(sCheck())); connect(_title, SIGNAL(lostFocus()), this, SLOT(sCheck())); connect(_phone, SIGNAL(lostFocus()), this, SLOT(sCheck())); connect(_phone2, SIGNAL(lostFocus()), this, SLOT(sCheck())); connect(_fax, SIGNAL(lostFocus()), this, SLOT(sCheck())); connect(emailEdit, SIGNAL(lostFocus()), this, SLOT(sCheck())); connect(_webaddr, SIGNAL(lostFocus()), this, SLOT(sCheck())); connect(_address, SIGNAL(changed()), this, SLOT(sCheck())); connect(_email, SIGNAL(currentIndexChanged(int)), this, SLOT(sEmailIndexChanged())); connect(_webaddr, SIGNAL(doubleClicked()), this, SLOT(sLaunchWebaddr())); setListVisible(true); connect(_first, SIGNAL(lostFocus()), this, SLOT(findDuplicates())); connect(_last, SIGNAL(lostFocus()), this, SLOT(findDuplicates())); connect(_crmAcct, SIGNAL(newId(int)), this, SLOT(setSearchAcct(int))); setFocusPolicy(Qt::StrongFocus); setFocusProxy(_honorific); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); setLabel(""); _limits = 0; silentSetId(-1); setOwnerVisible(false); _mode = Edit; }
Button::Button(const QString &text, QWidget *parent) : QToolButton(parent) { setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); setText(text); }
PowerlineView::PowerlineView(QWidget *parent) :QGraphicsView(parent) ,m_scene(0) ,m_InternetNode(0) ,m_InternetEdge(0) ,m_RouterNode(0) ,m_RouterEdge(0) //,m_routerRefreshTimerId(0) ,m_MouseOverNodeIdx(-1) ,m_TopEdge(NULL) ,m_TopNode(NULL) ,m_LocalDevSonPowel(0) ,m_nodePic(NULL) ,m_nextBtnProxy(NULL) ,m_nextPageBtn(NULL) ,m_prevPageBtn(NULL) ,m_preBtnProxy(NULL) ,m_idxStartPos(0) ,m_cacheData(NULL) ,m_bFirstStart(false) ,m_localDevPCState(LOS_INIT) ,m_IsInternetConnected(true) ,m_lstPlDev(NULL) ,m_IsRouterOk(false) ,m_plLocalDevNode(NULL) ,m_plLocalDevEdge(NULL) { setViewportUpdateMode(FullViewportUpdate); setAttribute(Qt::WA_TranslucentBackground); setRenderHint(QPainter::Antialiasing); setCacheMode(QGraphicsView::CacheBackground); setStyleSheet(QString(TOPOLOGYVIEW_STYLE)); m_scene = new QGraphicsScene(this); // m_scene->setSceneRect(QRectF(-257.443,-37.3571 ,515.985,74.7142) ); m_scene->setSceneRect(QRectF(0,0 ,515.985,74.7142) ); m_scene->setItemIndexMethod(QGraphicsScene::NoIndex); // this->setInteractive(true); this->setScene(m_scene); setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); //////两个翻页按钮 m_nextPageBtn = new QPushButton(); m_prevPageBtn = new QPushButton(); m_prevPageBtn->setObjectName("prevPageBtn"); m_nextPageBtn->setObjectName("nextPageBtn"); m_prevPageBtn->setAttribute(Qt::WA_TranslucentBackground); m_nextPageBtn->setAttribute(Qt::WA_TranslucentBackground); m_preBtnProxy = m_scene->addWidget(m_prevPageBtn); m_nextBtnProxy = m_scene->addWidget(m_nextPageBtn); m_prevPageBtn->setVisible(false); m_nextPageBtn->setVisible(false); //m_preBtnProxy->setAcceptHoverEvents(true); //m_nextBtnProxy->setAcceptHoverEvents(true); qreal r2 = 74.7142 / 2; m_preBtnProxy->setPos(-50, r2); m_nextBtnProxy->setPos(545, r2); connect(m_nextPageBtn, SIGNAL(clicked()), this, SLOT(BtnClick())); connect(m_prevPageBtn, SIGNAL(clicked()), this, SLOT(BtnClick())); ///////////End ///////锁的图片节点 m_nodePic = new PowerlineNode(); m_scene->addItem(m_nodePic); m_nodePic->m_deviceType = GDT_UNLOCKPIC; m_nodePic->hide(); //connect(m_nodePic, SIGNAL(nodeMouseOver(int)), this, SLOT(onMouseOverNode(int))); /////////End initStyle(); }
ParameterGroup::ParameterGroup(QWidget *pParent, const char *pName) : QGroupBox(pParent) { if(pName) setObjectName(pName); _type = AdhocGroup; setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); QWidget *selectedGroup = new QWidget(this); QWidget *patternGroup = new QWidget(this); _all= new QRadioButton(QObject::tr("All"), this, "_all"); _all->setChecked(TRUE); _selected = new QRadioButton(tr("Selected:"), selectedGroup, "_selected"); _items = new XComboBox(FALSE, selectedGroup, "_items"); _items->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); _items->setEnabled(FALSE); QHBoxLayout * hLayout = new QHBoxLayout(selectedGroup); hLayout->setSpacing(5); hLayout->setMargin(0); hLayout->addWidget(_selected); hLayout->addWidget(_items); selectedGroup->setLayout(hLayout); _usePattern = new QRadioButton(tr("Pattern:"), patternGroup, "_usePattern"); _pattern = new QLineEdit(patternGroup, "_pattern"); _pattern->setEnabled(FALSE); hLayout = new QHBoxLayout(patternGroup); hLayout->setSpacing(5); hLayout->setMargin(0); hLayout->addWidget(_usePattern); hLayout->addWidget(_pattern); patternGroup->setLayout(hLayout); QVBoxLayout * vLayout = new QVBoxLayout(this); vLayout->setSpacing(0); vLayout->setMargin(5); vLayout->addWidget(_all); vLayout->addWidget(selectedGroup); vLayout->addWidget(patternGroup); setLayout(vLayout); QButtonGroup * buttonGroup = new QButtonGroup(this); buttonGroup->addButton(_all); buttonGroup->addButton(_selected); buttonGroup->addButton(_usePattern); connect(_selected, SIGNAL(toggled(bool)), _items, SLOT(setEnabled(bool))); connect(_usePattern, SIGNAL(toggled(bool)), _pattern, SLOT(setEnabled(bool))); connect(buttonGroup, SIGNAL(buttonClicked(int)), this, SIGNAL(updated())); connect(_items, SIGNAL(newID(int)), this, SIGNAL(updated())); connect(_pattern, SIGNAL(lostFocus()), this, SIGNAL(updated())); setFocusProxy(_all); }
QFramelessButton::QFramelessButton( QWidget *parent ) : QPushButton( parent ) { setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ); }
SquareWidget() { QSizePolicy policy = sizePolicy(); policy.setHeightForWidth(true); setSizePolicy(policy); }
ConfigGadgetWidget::ConfigGadgetWidget(QWidget *parent) : QWidget(parent) { setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); stackWidget = new MyTabbedStackWidget(this, true, true); stackWidget->setIconSize(64); QVBoxLayout *layout = new QVBoxLayout; layout->setContentsMargins(0, 0, 0, 0); layout->addWidget(stackWidget); setLayout(layout); ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); QWidget *widget; QIcon *icon; icon = new QIcon(); icon->addFile(":/configgadget/images/hardware_normal.png", QSize(), QIcon::Normal, QIcon::Off); icon->addFile(":/configgadget/images/hardware_selected.png", QSize(), QIcon::Selected, QIcon::Off); widget = new DefaultConfigWidget(this, tr("Hardware")); stackWidget->insertTab(ConfigGadgetWidget::Hardware, widget, *icon, QString("Hardware")); icon = new QIcon(); icon->addFile(":/configgadget/images/vehicle_normal.png", QSize(), QIcon::Normal, QIcon::Off); icon->addFile(":/configgadget/images/vehicle_selected.png", QSize(), QIcon::Selected, QIcon::Off); widget = new ConfigVehicleTypeWidget(this); static_cast<ConfigTaskWidget *>(widget)->bind(); stackWidget->insertTab(ConfigGadgetWidget::Aircraft, widget, *icon, QString("Vehicle")); icon = new QIcon(); icon->addFile(":/configgadget/images/input_normal.png", QSize(), QIcon::Normal, QIcon::Off); icon->addFile(":/configgadget/images/input_selected.png", QSize(), QIcon::Selected, QIcon::Off); widget = new ConfigInputWidget(this); static_cast<ConfigTaskWidget *>(widget)->bind(); stackWidget->insertTab(ConfigGadgetWidget::Input, widget, *icon, QString("Input")); icon = new QIcon(); icon->addFile(":/configgadget/images/output_normal.png", QSize(), QIcon::Normal, QIcon::Off); icon->addFile(":/configgadget/images/output_selected.png", QSize(), QIcon::Selected, QIcon::Off); widget = new ConfigOutputWidget(this); static_cast<ConfigTaskWidget *>(widget)->bind(); stackWidget->insertTab(ConfigGadgetWidget::Output, widget, *icon, QString("Output")); icon = new QIcon(); icon->addFile(":/configgadget/images/ins_normal.png", QSize(), QIcon::Normal, QIcon::Off); icon->addFile(":/configgadget/images/ins_selected.png", QSize(), QIcon::Selected, QIcon::Off); widget = new DefaultConfigWidget(this, tr("Attitude")); stackWidget->insertTab(ConfigGadgetWidget::Sensors, widget, *icon, QString("Attitude")); icon = new QIcon(); icon->addFile(":/configgadget/images/stabilization_normal.png", QSize(), QIcon::Normal, QIcon::Off); icon->addFile(":/configgadget/images/stabilization_selected.png", QSize(), QIcon::Selected, QIcon::Off); widget = new ConfigStabilizationWidget(this); static_cast<ConfigTaskWidget *>(widget)->bind(); stackWidget->insertTab(ConfigGadgetWidget::Stabilization, widget, *icon, QString("Stabilization")); icon = new QIcon(); icon->addFile(":/configgadget/images/camstab_normal.png", QSize(), QIcon::Normal, QIcon::Off); icon->addFile(":/configgadget/images/camstab_selected.png", QSize(), QIcon::Selected, QIcon::Off); widget = new ConfigCameraStabilizationWidget(this); static_cast<ConfigTaskWidget *>(widget)->bind(); stackWidget->insertTab(ConfigGadgetWidget::CameraStabilization, widget, *icon, QString("Gimbal")); icon = new QIcon(); icon->addFile(":/configgadget/images/txpid_normal.png", QSize(), QIcon::Normal, QIcon::Off); icon->addFile(":/configgadget/images/txpid_selected.png", QSize(), QIcon::Selected, QIcon::Off); widget = new ConfigTxPIDWidget(this); static_cast<ConfigTaskWidget *>(widget)->bind(); stackWidget->insertTab(ConfigGadgetWidget::TxPid, widget, *icon, QString("TxPID")); icon = new QIcon(); icon->addFile(":/configgadget/images/pipx-normal.png", QSize(), QIcon::Normal, QIcon::Off); icon->addFile(":/configgadget/images/pipx-selected.png", QSize(), QIcon::Selected, QIcon::Off); widget = new DefaultConfigWidget(this, tr("OPLink Configuration")); stackWidget->insertTab(ConfigGadgetWidget::OPLink, widget, *icon, QString("OPLink")); stackWidget->setCurrentIndex(ConfigGadgetWidget::Hardware); // connect to autopilot connection events TelemetryManager *tm = pm->getObject<TelemetryManager>(); connect(tm, SIGNAL(connected()), this, SLOT(onAutopilotConnect())); connect(tm, SIGNAL(disconnected()), this, SLOT(onAutopilotDisconnect())); // check if we are already connected if (tm->isConnected()) { onAutopilotConnect(); } // connect to oplink manager OPLinkManager *om = pm->getObject<OPLinkManager>(); connect(om, SIGNAL(connected()), this, SLOT(onOPLinkConnect())); connect(om, SIGNAL(disconnected()), this, SLOT(onOPLinkDisconnect())); // check if we are already connected if (om->isConnected()) { onOPLinkConnect(); } help = 0; connect(stackWidget, SIGNAL(currentAboutToShow(int, bool *)), this, SLOT(tabAboutToChange(int, bool *))); }
void ContactCluster::init() { _ignoreSignals = false; _titleSingular = tr("Contact"); _titlePlural = tr("Contacts"); _query = "SELECT cntct.*, crmacct_name " "FROM cntct LEFT OUTER JOIN crmacct ON (cntct_crmacct_id = crmacct_id) "; _layoutDone = false; _minimalLayout = false; _grid->removeWidget(_label); // will be reinserted _grid->removeWidget(_description); _grid->removeWidget(_list); // will be reinserted _grid->removeWidget(_info); // will be reinserted delete _description; _grid->setMargin(0); _grid->setSpacing(2); _nameBox = new QHBoxLayout; _nameBox->setSpacing(2); _titleBox = new QHBoxLayout; _titleBox->setSpacing(2); _change = new QLineEdit(this); _numberLit = new QLabel(tr("Number:"), this, "_numberLit"); _number = new QLineEdit(this, "_number"); _change->hide(); _number->hide(); _numberLit->hide(); _honorific = new XComboBox(this, "_honorific"); _firstLit = new QLabel(tr("First:"), this, "_firstLit"); _first = new QLineEdit(this, "_first"); _lastLit = new QLabel(tr("Last:"), this, "_lastLit"); _last = new QLineEdit(this, "_last"); _initialsLit = new QLabel(tr("Initials:"), this, "_initialsLit"); _initials = new QLineEdit(this, "_initials"); _initials->resize(_initials->size().width() / 3, _initials->size().height()); _titleLit = new QLabel(tr("Job Title:"), this, "_titleLit"); _title = new QLineEdit(this, "_title"); _mapper = new XDataWidgetMapper(this); _nameBox->addWidget(_honorific, 0); _nameBox->addWidget(_firstLit, 0); _nameBox->addWidget(_first, 1); _nameBox->addWidget(_lastLit, 0); _nameBox->addWidget(_last, 2); _nameBox->addWidget(_initialsLit, 0); _nameBox->addWidget(_initials, 0); _nameBox->addWidget(_list, 0, Qt::AlignRight); _nameBox->addWidget(_info, 0, Qt::AlignRight); _titleBox->addWidget(_titleLit, 0); _titleBox->addWidget(_title, 2); _buttonBox = new QHBoxLayout; _crmAcct = new CRMAcctCluster(this, "_crmAcct"); _active = new QCheckBox(tr("Active"), this, "_active"); _buttonBox->addWidget(_crmAcct, 1, Qt::AlignLeft); _buttonBox->addStretch(); _buttonBox->addWidget(_active, 0); _phoneLit = new QLabel(tr("Voice:"), this, "_phoneLit"); _phone = new QLineEdit(this, "_phone"); _phone2Lit = new QLabel(tr("Alternate:"), this, "_phone2Lit"); _phone2 = new QLineEdit(this, "_phone2"); _faxLit = new QLabel(tr("Fax:"), this, "_faxLit"); _fax = new QLineEdit(this, "_fax"); _emailLit = new QLabel(tr("E-Mail:"), this, "_emailLit"); _email = new QLineEdit(this, "_email"); _webaddrLit = new QLabel(tr("Web:"), this, "_webaddrLit"); _webaddr = new QLineEdit(this, "_webaddr"); _address = new AddressCluster(this, "_address"); _numberLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _label->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); _firstLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _lastLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _titleLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _phoneLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _phone2Lit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _faxLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _emailLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _initialsLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _webaddrLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _honorific->setEditable(true); _honorific->setType(XComboBox::Honorifics); _crmAcct->setLabel(tr("CRM Account:")); layout(); connect(_list, SIGNAL(clicked()), this, SLOT(sEllipses())); connect(_info, SIGNAL(clicked()), this, SLOT(sInfo())); connect(_honorific, SIGNAL(newID(int)), this, SIGNAL(changed())); connect(_first, SIGNAL(textChanged(const QString&)), this, SIGNAL(changed())); connect(_last, SIGNAL(textChanged(const QString&)), this, SIGNAL(changed())); connect(_initials, SIGNAL(textChanged(const QString&)), this, SIGNAL(changed())); connect(_crmAcct, SIGNAL(newId(int)), this, SIGNAL(changed())); connect(_phone, SIGNAL(textChanged(const QString&)), this, SIGNAL(changed())); connect(_phone2, SIGNAL(textChanged(const QString&)), this, SIGNAL(changed())); connect(_fax, SIGNAL(textChanged(const QString&)), this, SIGNAL(changed())); connect(_email, SIGNAL(textChanged(const QString&)), this, SIGNAL(changed())); connect(_webaddr, SIGNAL(textChanged(const QString&)), this, SIGNAL(changed())); connect(_address, SIGNAL(changed()), this, SIGNAL(changed())); connect(_honorific, SIGNAL(newID(int)), this, SLOT(sCheck())); connect(_first, SIGNAL(lostFocus()), this, SLOT(sCheck())); connect(_last, SIGNAL(lostFocus()), this, SLOT(sCheck())); connect(_initials, SIGNAL(lostFocus()), this, SLOT(sCheck())); connect(_crmAcct, SIGNAL(newId(int)), this, SLOT(sCheck())); connect(_phone, SIGNAL(lostFocus()), this, SLOT(sCheck())); connect(_phone2, SIGNAL(lostFocus()), this, SLOT(sCheck())); connect(_fax, SIGNAL(lostFocus()), this, SLOT(sCheck())); connect(_email, SIGNAL(lostFocus()), this, SLOT(sCheck())); connect(_webaddr, SIGNAL(lostFocus()), this, SLOT(sCheck())); connect(_address, SIGNAL(changed()), this, SLOT(sCheck())); setFocusPolicy(Qt::StrongFocus); setFocusProxy(_honorific); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); setLabel(""); _limits = 0; setInfoVisible(false); // TODO - remove this and implement Info button silentSetId(-1); }
SignatureWidget::SignatureWidget( const DigiDocSignature &signature, unsigned int signnum, QWidget *parent ) : QLabel( parent ) , num( signnum ) , s( signature ) { setSizePolicy( QSizePolicy::Ignored, QSizePolicy::Preferred ); setWordWrap( true ); const SslCertificate cert = s.cert(); QString content; QTextStream st( &content ); if( cert.isTempel() ) st << "<img src=\":/images/ico_stamp_blue_16.png\">"; else st << "<img src=\":/images/ico_person_blue_16.png\">"; st << "<b>" << Qt::escape( cert.toString( cert.showCN() ? "CN" : "GN SN" ) ) << "</b>"; QString tooltip; QTextStream t( &tooltip ); QDateTime date = s.dateTime(); if( !s.location().isEmpty() ) { st << "<br />" << Qt::escape( s.location() ); t << Qt::escape( s.location() ) << "<br />"; } if( !s.role().isEmpty() ) { st << "<br />" << Qt::escape( s.role() ); t << Qt::escape( s.role() ) << "<br />"; } if( !date.isNull() ) { st << "<br />" << tr("Signed on") << " " << SslCertificate::formatDate( date, "dd. MMMM yyyy" ) << " " << tr("time") << " " << date.toString( "hh:mm" ); t << tr("Signed on") << " " << SslCertificate::formatDate( date, "dd. MMMM yyyy" ) << " " << tr("time") << " " << date.toString( "hh:mm" ); } setToolTip( tooltip ); st << "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\"><tr>"; st << "<td>" << tr("Signature is") << " "; switch( s.validate() ) { case DigiDocSignature::Valid: st << "<font color=\"green\">" << tr("valid"); break; case DigiDocSignature::Invalid: st << "<font color=\"red\">" << tr("not valid"); break; case DigiDocSignature::Unknown: st << "<font color=\"red\">" << tr("unknown"); break; } if( signature.isTest() ) st << " (" << tr("Test signature") << ")"; st << "</font>"; st << "</td><td align=\"right\">"; st << "<a href=\"details\">" << tr("Show details") << "</a>"; st << "</td></tr><tr><td></td>"; st << "<td align=\"right\">"; st << "<a href=\"remove\">" << tr("Remove") << "</a>"; st << "</td></tr></table>"; setText( content ); connect( this, SIGNAL(linkActivated(QString)), SLOT(link(QString)) ); }
/* * Constructs a BezierWidgetBase as a child of 'parent', with the * name 'name' and widget flags set to 'f'. */ BezierWidgetBase::BezierWidgetBase( QWidget* parent, const char* name, WFlags fl ) : QWidget( parent, name, fl ) { QImage img; img.loadFromData( image0_data, sizeof( image0_data ), "PNG" ); image0 = img; if ( !name ) setName( "bezierwidgetbase" ); setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)1, 0, 0, sizePolicy().hasHeightForWidth() ) ); setMinimumSize( QSize( 910, 540 ) ); setIcon( image0 ); setMouseTracking( TRUE ); bezierwidgetbaseLayout = new QGridLayout( this, 1, 1, 11, 6, "bezierwidgetbaseLayout"); layout15 = new QHBoxLayout( 0, 0, 6, "layout15"); spacer5_2 = new QSpacerItem( 170, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); layout15->addItem( spacer5_2 ); textLabel3 = new QLabel( this, "textLabel3" ); textLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, textLabel3->sizePolicy().hasHeightForWidth() ) ); textLabel3->setMinimumSize( QSize( 500, 10 ) ); textLabel3->setMaximumSize( QSize( 32767, 15 ) ); layout15->addWidget( textLabel3 ); spacer5 = new QSpacerItem( 220, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); layout15->addItem( spacer5 ); bezierwidgetbaseLayout->addLayout( layout15, 0, 0 ); layout13 = new QVBoxLayout( 0, 0, 6, "layout13"); qbezier = new Qbezier( this, "qbezier" ); qbezier->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)1, 0, 0, qbezier->sizePolicy().hasHeightForWidth() ) ); qbezier->setMinimumSize( QSize( 0, 220 ) ); qbezier->setMouseTracking( TRUE ); layout13->addWidget( qbezier ); bezierScroll = new QScrollBar( this, "bezierScroll" ); bezierScroll->setMaxValue( 0 ); bezierScroll->setLineStep( 1 ); bezierScroll->setOrientation( QScrollBar::Horizontal ); layout13->addWidget( bezierScroll ); bezierwidgetbaseLayout->addLayout( layout13, 2, 0 ); layout24 = new QHBoxLayout( 0, 0, 6, "layout24"); groupBox1 = new QGroupBox( this, "groupBox1" ); groupBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, groupBox1->sizePolicy().hasHeightForWidth() ) ); textLabel1_2 = new QLabel( groupBox1, "textLabel1_2" ); textLabel1_2->setGeometry( QRect( 10, 20, 59, 20 ) ); ChkEnableScroll = new QCheckBox( groupBox1, "ChkEnableScroll" ); ChkEnableScroll->setGeometry( QRect( 10, 80, 101, 21 ) ); GridScale = new QLineEdit( groupBox1, "GridScale" ); GridScale->setEnabled( FALSE ); GridScale->setGeometry( QRect( 80, 50, 50, 21 ) ); textLabel1_2_3 = new QLabel( groupBox1, "textLabel1_2_3" ); textLabel1_2_3->setEnabled( FALSE ); textLabel1_2_3->setGeometry( QRect( 10, 50, 50, 20 ) ); FormGridWidth = new QLineEdit( groupBox1, "FormGridWidth" ); FormGridWidth->setGeometry( QRect( 80, 20, 50, 21 ) ); layout24->addWidget( groupBox1 ); groupBox1_2 = new QGroupBox( this, "groupBox1_2" ); groupBox1_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, groupBox1_2->sizePolicy().hasHeightForWidth() ) ); textLabel1_3 = new QLabel( groupBox1_2, "textLabel1_3" ); textLabel1_3->setGeometry( QRect( 10, 20, 66, 20 ) ); textLabel1_2_2 = new QLabel( groupBox1_2, "textLabel1_2_2" ); textLabel1_2_2->setGeometry( QRect( 10, 50, 50, 20 ) ); ReverseSeek = new QCheckBox( groupBox1_2, "ReverseSeek" ); ReverseSeek->setGeometry( QRect( 10, 80, 101, 21 ) ); FormMinPos = new QLineEdit( groupBox1_2, "FormMinPos" ); FormMinPos->setGeometry( QRect( 70, 50, 50, 21 ) ); FormMaxPos = new QLineEdit( groupBox1_2, "FormMaxPos" ); FormMaxPos->setGeometry( QRect( 70, 20, 50, 21 ) ); layout24->addWidget( groupBox1_2 ); groupBox7 = new QGroupBox( this, "groupBox7" ); groupBox7->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, groupBox7->sizePolicy().hasHeightForWidth() ) ); groupBox7->setMinimumSize( QSize( 478, 0 ) ); groupBox7->setColumnLayout(0, Qt::Vertical ); groupBox7->layout()->setSpacing( 6 ); groupBox7->layout()->setMargin( 11 ); groupBox7Layout = new QGridLayout( groupBox7->layout() ); groupBox7Layout->setAlignment( Qt::AlignTop ); splitter1 = new QSplitter( groupBox7, "splitter1" ); splitter1->setOrientation( QSplitter::Horizontal ); listRegOut = new QListView( splitter1, "listRegOut" ); listRegOut->addColumn( tr( "Td" ) ); listRegOut->addColumn( tr( "Pos" ) ); listRegOut->addColumn( tr( "Tin" ) ); listRegOut->addColumn( tr( "Tout" ) ); listRegOut->setMaximumSize( QSize( 500, 32767 ) ); listRegOut->setResizeMode( QListView::AllColumns ); listRegOutHex = new QListView( splitter1, "listRegOutHex" ); listRegOutHex->addColumn( tr( "Td" ) ); listRegOutHex->addColumn( tr( "Pos" ) ); listRegOutHex->addColumn( tr( "Tin" ) ); listRegOutHex->addColumn( tr( "Tout" ) ); listRegOutHex->setResizeMode( QListView::AllColumns ); groupBox7Layout->addMultiCellWidget( splitter1, 0, 1, 0, 0 ); btnOSSend = new QPushButton( groupBox7, "btnOSSend" ); btnOSSend->setMaximumSize( QSize( 60, 32767 ) ); groupBox7Layout->addWidget( btnOSSend, 1, 1 ); servoList = new QListView( groupBox7, "servoList" ); servoList->addColumn( tr( "sv" ) ); servoList->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, servoList->sizePolicy().hasHeightForWidth() ) ); servoList->setMinimumSize( QSize( 60, 60 ) ); servoList->setMaximumSize( QSize( 60, 66 ) ); servoList->setVScrollBarMode( QListView::AlwaysOn ); servoList->setHScrollBarMode( QListView::AlwaysOff ); groupBox7Layout->addWidget( servoList, 0, 1 ); layout24->addWidget( groupBox7 ); spacer3_2 = new QSpacerItem( 16, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); layout24->addItem( spacer3_2 ); ServoSim = new QServo( this, "ServoSim" ); ServoSim->setMinimumSize( QSize( 110, 110 ) ); ServoSim->setMaximumSize( QSize( 110, 110 ) ); layout24->addWidget( ServoSim ); bezierwidgetbaseLayout->addLayout( layout24, 1, 0 ); layout11 = new QHBoxLayout( 0, 0, 6, "layout11"); layout19 = new QHBoxLayout( 0, 0, 6, "layout19"); layout18 = new QVBoxLayout( 0, 0, 6, "layout18"); textLabel2_2 = new QLabel( this, "textLabel2_2" ); textLabel2_2->setMinimumSize( QSize( 75, 16 ) ); layout18->addWidget( textLabel2_2 ); label = new QLabel( this, "label" ); label->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, label->sizePolicy().hasHeightForWidth() ) ); label->setMinimumSize( QSize( 75, 16 ) ); label->setMaximumSize( QSize( 50, 32767 ) ); layout18->addWidget( label ); layout19->addLayout( layout18 ); layout17 = new QVBoxLayout( 0, 0, 6, "layout17"); textLabel2 = new QLabel( this, "textLabel2" ); textLabel2->setMinimumSize( QSize( 75, 16 ) ); layout17->addWidget( textLabel2 ); FormTimePos = new QLabel( this, "FormTimePos" ); FormTimePos->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, FormTimePos->sizePolicy().hasHeightForWidth() ) ); FormTimePos->setMinimumSize( QSize( 75, 16 ) ); FormTimePos->setMaximumSize( QSize( 50, 32767 ) ); layout17->addWidget( FormTimePos ); layout19->addLayout( layout17 ); layout16 = new QVBoxLayout( 0, 0, 6, "layout16"); textLabel2_3 = new QLabel( this, "textLabel2_3" ); textLabel2_3->setMinimumSize( QSize( 75, 16 ) ); textLabel2_3->setAlignment( int( QLabel::AlignCenter ) ); layout16->addWidget( textLabel2_3 ); FormMotorPos = new QLabel( this, "FormMotorPos" ); FormMotorPos->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, FormMotorPos->sizePolicy().hasHeightForWidth() ) ); FormMotorPos->setMinimumSize( QSize( 75, 16 ) ); FormMotorPos->setMaximumSize( QSize( 50, 32767 ) ); layout16->addWidget( FormMotorPos ); layout19->addLayout( layout16 ); layout15_2 = new QVBoxLayout( 0, 0, 6, "layout15_2"); textLabel2_3_2 = new QLabel( this, "textLabel2_3_2" ); textLabel2_3_2->setMinimumSize( QSize( 75, 16 ) ); textLabel2_3_2->setAlignment( int( QLabel::AlignCenter ) ); layout15_2->addWidget( textLabel2_3_2 ); FormMotorSpeed = new QLabel( this, "FormMotorSpeed" ); FormMotorSpeed->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, FormMotorSpeed->sizePolicy().hasHeightForWidth() ) ); FormMotorSpeed->setMinimumSize( QSize( 75, 16 ) ); FormMotorSpeed->setMaximumSize( QSize( 50, 32767 ) ); layout15_2->addWidget( FormMotorSpeed ); layout19->addLayout( layout15_2 ); layout11->addLayout( layout19 ); layout10 = new QGridLayout( 0, 1, 1, 0, 6, "layout10"); textLabel2_4 = new QLabel( this, "textLabel2_4" ); layout10->addWidget( textLabel2_4, 0, 1 ); textLabel2_4_2 = new QLabel( this, "textLabel2_4_2" ); textLabel2_4_2->setMinimumSize( QSize( 40, 0 ) ); textLabel2_4_2->setMaximumSize( QSize( 40, 32767 ) ); layout10->addWidget( textLabel2_4_2, 1, 1 ); textLabel1_4 = new QLabel( this, "textLabel1_4" ); textLabel1_4->setMinimumSize( QSize( 15, 15 ) ); textLabel1_4->setMaximumSize( QSize( 15, 15 ) ); textLabel1_4->setPaletteBackgroundColor( QColor( 0, 170, 0 ) ); layout10->addWidget( textLabel1_4, 1, 0 ); textLabel1 = new QLabel( this, "textLabel1" ); textLabel1->setMinimumSize( QSize( 15, 15 ) ); textLabel1->setMaximumSize( QSize( 15, 15 ) ); textLabel1->setPaletteBackgroundColor( QColor( 255, 0, 0 ) ); layout10->addWidget( textLabel1, 0, 0 ); layout11->addLayout( layout10 ); spacer8 = new QSpacerItem( 30, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); layout11->addItem( spacer8 ); groupBox4 = new QGroupBox( this, "groupBox4" ); groupBox4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, groupBox4->sizePolicy().hasHeightForWidth() ) ); groupBox4->setMinimumSize( QSize( 10, 45 ) ); groupBox4->setMaximumSize( QSize( 32767, 100 ) ); FormGridDel = new QPushButton( groupBox4, "FormGridDel" ); FormGridDel->setGeometry( QRect( 70, 20, 50, 21 ) ); FormGridAdd = new QPushButton( groupBox4, "FormGridAdd" ); FormGridAdd->setGeometry( QRect( 10, 20, 50, 21 ) ); layout11->addWidget( groupBox4 ); groupBox5 = new QGroupBox( this, "groupBox5" ); groupBox5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, groupBox5->sizePolicy().hasHeightForWidth() ) ); groupBox5->setMinimumSize( QSize( 10, 45 ) ); FormBtnSimStart = new QPushButton( groupBox5, "FormBtnSimStart" ); FormBtnSimStart->setGeometry( QRect( 11, 20, 61, 20 ) ); FormBtnSimPause = new QPushButton( groupBox5, "FormBtnSimPause" ); FormBtnSimPause->setGeometry( QRect( 193, 20, 66, 20 ) ); ServoSimLoop = new QCheckBox( groupBox5, "ServoSimLoop" ); ServoSimLoop->setGeometry( QRect( 76, 20, 50, 20 ) ); FormBtnSimStop = new QPushButton( groupBox5, "FormBtnSimStop" ); FormBtnSimStop->setGeometry( QRect( 128, 20, 59, 20 ) ); layout11->addWidget( groupBox5 ); groupBox6 = new QGroupBox( this, "groupBox6" ); groupBox6->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, groupBox6->sizePolicy().hasHeightForWidth() ) ); groupBox6->setMinimumSize( QSize( 10, 45 ) ); groupBox6->setMaximumSize( QSize( 55, 32767 ) ); lblDebug = new QLabel( groupBox6, "lblDebug" ); lblDebug->setGeometry( QRect( 10, 21, 40, 20 ) ); layout11->addWidget( groupBox6 ); bezierwidgetbaseLayout->addLayout( layout11, 3, 0 ); languageChange(); resize( QSize(910, 540).expandedTo(minimumSizeHint()) ); clearWState( WState_Polished ); // signals and slots connections connect( FormGridWidth, SIGNAL( textChanged(const QString&) ), this, SLOT( gridTimeChange(const QString&) ) ); connect( FormMaxPos, SIGNAL( textChanged(const QString&) ), this, SLOT( servoMaxPosChange(const QString&) ) ); connect( FormMinPos, SIGNAL( textChanged(const QString&) ), this, SLOT( servoMinPosChange(const QString&) ) ); connect( FormBtnSimStart, SIGNAL( clicked() ), this, SLOT( BtnSimStart() ) ); connect( FormBtnSimStop, SIGNAL( clicked() ), this, SLOT( BtnSimStop() ) ); connect( FormBtnSimPause, SIGNAL( clicked() ), this, SLOT( BtnSimPause() ) ); connect( FormGridAdd, SIGNAL( clicked() ), this, SLOT( BtnGridAdd() ) ); connect( FormGridDel, SIGNAL( clicked() ), this, SLOT( BtnGridDel() ) ); connect( bezierScroll, SIGNAL( valueChanged(int) ), this, SLOT( FormBezierScroll(int) ) ); connect( qbezier, SIGNAL( setXY(int,int) ), this, SLOT( setLabelXY(int,int) ) ); connect( qbezier, SIGNAL( calcparams() ), this, SLOT( UpdateRegisters() ) ); connect( ChkEnableScroll, SIGNAL( toggled(bool) ), this, SLOT( enableScroll(bool) ) ); connect( qbezier, SIGNAL( setInfo(QString&) ), this, SLOT( infoUpdate(QString&) ) ); connect( btnOSSend, SIGNAL( clicked() ), this, SLOT( BtnOSsendCurve() ) ); connect( servoList, SIGNAL( selectionChanged(QListViewItem*) ), this, SLOT( servoChanged(QListViewItem*) ) ); // tab order setTabOrder( FormGridWidth, FormBtnSimStart ); setTabOrder( FormBtnSimStart, ChkEnableScroll ); setTabOrder( ChkEnableScroll, GridScale ); setTabOrder( GridScale, ReverseSeek ); setTabOrder( ReverseSeek, FormMinPos ); setTabOrder( FormMinPos, FormMaxPos ); setTabOrder( FormMaxPos, listRegOut ); setTabOrder( listRegOut, FormGridAdd ); setTabOrder( FormGridAdd, FormGridDel ); setTabOrder( FormGridDel, FormBtnSimStop ); setTabOrder( FormBtnSimStop, FormBtnSimPause ); }
KexiDBImageBox::KexiDBImageBox(bool designMode, QWidget *parent) : KexiFrame(parent /* Qt 4 not neede: , Qt::WNoAutoErase*/) , KexiFormDataItemInterface() , m_alignment(Qt::AlignAuto | Qt::AlignTop) //2.0 moved to FormWidgetInterface , m_designMode(designMode) , m_readOnly(false) , m_scaledContents(false) , m_smoothTransformation(true) , m_keepAspectRatio(true) , m_insideSetData(false) , m_setFocusOnButtonAfterClosingPopup(false) // , m_lineWidthChanged(false) , m_paintEventEnabled(true) , m_dropDownButtonVisible(true) , m_insideSetPalette(false) { setDesignMode(designMode); installEventFilter(this); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); QPalette pal(palette()); pal.setBrush(backgroundRole(), QBrush(Qt::transparent)); KexiFrame::setPalette(pal); //setup context menu m_contextMenu = new KexiImageContextMenu(this); m_contextMenu->installEventFilter(this); if (designMode) { m_chooser = 0; } else { m_chooser = new KexiDropDownButton(this); m_chooser->setFocusPolicy(Qt::StrongFocus); m_chooser->setMenu(m_contextMenu); setFocusProxy(m_chooser); m_chooser->installEventFilter(this); // m_chooser->setPalette(qApp->palette()); // hlyr->addWidget(m_chooser); } setFrameShape(QFrame::Box); setFrameShadow(QFrame::Plain); setFrameColor(palette().color(QPalette::Foreground)); m_paletteBackgroundColorChanged = false; //set this here, not before connect(m_contextMenu, SIGNAL(updateActionsAvailabilityRequested(bool&,bool&)), this, SLOT(slotUpdateActionsAvailabilityRequested(bool&,bool&))); connect(m_contextMenu, SIGNAL(insertFromFileRequested(KUrl)), this, SLOT(handleInsertFromFileAction(KUrl))); connect(m_contextMenu, SIGNAL(saveAsRequested(QString)), this, SLOT(handleSaveAsAction(QString))); connect(m_contextMenu, SIGNAL(cutRequested()), this, SLOT(handleCutAction())); connect(m_contextMenu, SIGNAL(copyRequested()), this, SLOT(handleCopyAction())); connect(m_contextMenu, SIGNAL(pasteRequested()), this, SLOT(handlePasteAction())); connect(m_contextMenu, SIGNAL(clearRequested()), this, SLOT(clear())); connect(m_contextMenu, SIGNAL(showPropertiesRequested()), this, SLOT(handleShowPropertiesAction())); // connect(m_contextMenu, SIGNAL(aboutToHide()), this, SLOT(slotAboutToHidePopupMenu())); // if (m_chooser) { //we couldn't use m_chooser->setPopup() because of drawing problems // connect(m_chooser, SIGNAL(pressed()), this, SLOT(slotChooserPressed())); // connect(m_chooser, SIGNAL(released()), this, SLOT(slotChooserReleased())); // connect(m_chooser, SIGNAL(toggled(bool)), this, SLOT(slotToggled(bool))); // } KexiFrame::setLineWidth(0); setDataSource(QString()); //to initialize popup menu and actions availability }
void X11EmbedContainer::embedSystemTrayClient(WId clientId) { Display *display = QX11Info::display(); if (!XGetWindowAttributes(display, clientId, &d->attr)) { emit error(QX11EmbedContainer::Unknown); return; } XSetWindowAttributes sAttr; sAttr.background_pixel = BlackPixel(display, DefaultScreen(display)); sAttr.border_pixel = BlackPixel(display, DefaultScreen(display)); sAttr.colormap = d->attr.colormap; WId parentId = parentWidget() ? parentWidget()->winId() : DefaultRootWindow(display); Window winId = XCreateWindow(display, parentId, 0, 0, d->attr.width, d->attr.height, 0, d->attr.depth, InputOutput, d->attr.visual, CWBackPixel | CWBorderPixel | CWColormap, &sAttr); XWindowAttributes attr; if (!XGetWindowAttributes(display, winId, &attr)) { emit error(QX11EmbedContainer::Unknown); return; } create(winId); XRenderPictFormat *format = XRenderFindVisualFormat(display, d->attr.visual); if (format && format->type == PictTypeDirect && format->direct.alphaMask && FdoSelectionManager::manager()->haveComposite()) { // Redirect ARGB windows to offscreen storage so we can composite them ourselves XRenderPictureAttributes attr; attr.subwindow_mode = IncludeInferiors; d->picture = XRenderCreatePicture(display, clientId, format, CPSubwindowMode, &attr); XCompositeRedirectSubwindows(display, winId, CompositeRedirectManual); FdoSelectionManager::manager()->addDamageWatch(this, clientId); //kDebug() << "Embedded client uses an ARGB visual -> compositing."; } else { //kDebug() << "Embedded client is not using an ARGB visual."; } // repeat everything from QX11EmbedContainer's ctor that might be relevant setFocusPolicy(Qt::StrongFocus); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); setAcceptDrops(true); setEnabled(false); XSelectInput(display, winId, KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | KeymapStateMask | PointerMotionMask | EnterWindowMask | LeaveWindowMask | FocusChangeMask | ExposureMask | StructureNotifyMask | SubstructureNotifyMask); XFlush(display); embedClient(clientId); // FIXME: This checks that the client is still valid. Qt won't pick it up // if the client closes before embedding completes. However, what happens // if the close happens after this point? Should checks happen on a timer // until embedding completes perhaps? if (!XGetWindowAttributes(QX11Info::display(), clientId, &d->attr)) { emit error(QX11EmbedContainer::Unknown); return; } }
CategoryListView(QWidget *parent = 0) : QListView(parent) { setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Expanding); setItemDelegate(new CategoryListViewDelegate(this)); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); }
void ProgramWindow::setup() { if (parentWidget() == NULL) { resize(500,700); setAttribute(Qt::WA_DeleteOnClose, true); } QFrame * mainFrame = new QFrame(this); QFrame * headerFrame = createHeader(); QFrame * centerFrame = createCenter(); layout()->setMargin(0); layout()->setSpacing(0); QGridLayout *layout = new QGridLayout(mainFrame); layout->setMargin(0); layout->setSpacing(0); layout->addWidget(headerFrame,0,0); layout->addWidget(centerFrame,1,0); setCentralWidget(mainFrame); setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); QSettings settings; if (!settings.value("programwindow/state").isNull()) { restoreState(settings.value("programwindow/state").toByteArray()); } if (!settings.value("programwindow/geometry").isNull()) { restoreGeometry(settings.value("programwindow/geometry").toByteArray()); } installEventFilter(this); // Setup new menu bar for the programming window QMenuBar * menubar = NULL; if (parentWidget()) { QMainWindow * mainWindow = qobject_cast<QMainWindow *>(parentWidget()); if (mainWindow) menubar = mainWindow->menuBar(); } if (menubar == NULL) menubar = menuBar(); m_fileMenu = menubar->addMenu(tr("&File")); QAction *currentAction = new QAction(tr("New Code File"), this); currentAction->setShortcut(tr("Ctrl+N")); currentAction->setStatusTip(tr("Create a new program")); connect(currentAction, SIGNAL(triggered()), this, SLOT(addTab())); m_fileMenu->addAction(currentAction); currentAction = new QAction(tr("&Open Code File..."), this); currentAction->setShortcut(tr("Ctrl+O")); currentAction->setStatusTip(tr("Open a program")); connect(currentAction, SIGNAL(triggered()), this, SLOT(loadProgramFile())); m_fileMenu->addAction(currentAction); m_fileMenu->addSeparator(); m_saveAction = new QAction(tr("&Save Code File"), this); m_saveAction->setShortcut(tr("Ctrl+S")); m_saveAction->setStatusTip(tr("Save the current program")); connect(m_saveAction, SIGNAL(triggered()), this, SLOT(save())); m_fileMenu->addAction(m_saveAction); currentAction = new QAction(tr("Rename Code File"), this); currentAction->setStatusTip(tr("Rename the current program")); connect(currentAction, SIGNAL(triggered()), this, SLOT(rename())); m_fileMenu->addAction(currentAction); currentAction = new QAction(tr("Duplicate tab"), this); currentAction->setStatusTip(tr("Copies the current program into a new tab")); connect(currentAction, SIGNAL(triggered()), this, SLOT(duplicateTab())); m_fileMenu->addAction(currentAction); m_fileMenu->addSeparator(); currentAction = new QAction(tr("Remove tab"), this); currentAction->setShortcut(tr("Ctrl+W")); currentAction->setStatusTip(tr("Remove the current program from the sketch")); connect(currentAction, SIGNAL(triggered()), this, SLOT(closeCurrentTab())); m_fileMenu->addAction(currentAction); m_fileMenu->addSeparator(); m_printAction = new QAction(tr("&Print..."), this); m_printAction->setShortcut(tr("Ctrl+P")); m_printAction->setStatusTip(tr("Print the current program")); connect(m_printAction, SIGNAL(triggered()), this, SLOT(print())); m_fileMenu->addAction(m_printAction); m_fileMenu->addSeparator(); currentAction = new QAction(tr("&Quit"), this); currentAction->setShortcut(tr("Ctrl+Q")); currentAction->setStatusTip(tr("Quit the application")); currentAction->setMenuRole(QAction::QuitRole); connect(currentAction, SIGNAL(triggered()), qApp, SLOT(closeAllWindows2())); m_fileMenu->addAction(currentAction); m_editMenu = menubar->addMenu(tr("&Edit")); m_undoAction = new QAction(tr("Undo"), this); m_undoAction->setShortcuts(QKeySequence::Undo); m_undoAction->setEnabled(false); connect(m_undoAction, SIGNAL(triggered()), this, SLOT(undo())); m_editMenu->addAction(m_undoAction); m_redoAction = new QAction(tr("Redo"), this); m_redoAction->setShortcuts(QKeySequence::Redo); m_redoAction->setEnabled(false); connect(m_redoAction, SIGNAL(triggered()), this, SLOT(redo())); m_editMenu->addAction(m_redoAction); m_editMenu->addSeparator(); m_cutAction = new QAction(tr("&Cut"), this); m_cutAction->setShortcut(tr("Ctrl+X")); m_cutAction->setStatusTip(tr("Cut selection")); m_cutAction->setEnabled(false); connect(m_cutAction, SIGNAL(triggered()), this, SLOT(cut())); m_editMenu->addAction(m_cutAction); m_copyAction = new QAction(tr("&Copy"), this); m_copyAction->setShortcut(tr("Ctrl+C")); m_copyAction->setStatusTip(tr("Copy selection")); m_copyAction->setEnabled(false); connect(m_copyAction, SIGNAL(triggered()), this, SLOT(copy())); m_editMenu->addAction(m_copyAction); currentAction = new QAction(tr("&Paste"), this); currentAction->setShortcut(tr("Ctrl+V")); currentAction->setStatusTip(tr("Paste clipboard contents")); // TODO: Check clipboard status and disable appropriately here connect(currentAction, SIGNAL(triggered()), this, SLOT(paste())); m_editMenu->addAction(currentAction); m_editMenu->addSeparator(); currentAction = new QAction(tr("&Select All"), this); currentAction->setShortcut(tr("Ctrl+A")); currentAction->setStatusTip(tr("Select all text")); connect(currentAction, SIGNAL(triggered()), this, SLOT(selectAll())); m_editMenu->addAction(currentAction); m_programMenu = menubar->addMenu(tr("&Code")); QMenu *languageMenu = new QMenu(tr("Select language"), this); m_programMenu->addMenu(languageMenu); QString currentLanguage = settings.value("programwindow/language", "").toString(); QStringList languages = getAvailableLanguages(); QActionGroup *languageActionGroup = new QActionGroup(this); foreach (QString language, languages) { currentAction = new QAction(language, this); currentAction->setCheckable(true); m_languageActions.insert(language, currentAction); languageActionGroup->addAction(currentAction); languageMenu->addAction(currentAction); if (!currentLanguage.isEmpty()) { if (language.compare(currentLanguage) == 0) { currentAction->setChecked(true); } } }
MainWindow::MainWindow( const QString& filename, QString tmpFileName, bool fakeRequested, QObject *parent ) { setStyleSheet( "background-color : rgb(251,248,241)" ); setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); setMinimumSize( 600, 400 ); QHBoxLayout *buttonLayout = new QHBoxLayout; QHBoxLayout *m_warningLayout = new QHBoxLayout; m_showSettings = new QPushButton( "Settings" ); m_cancel = new QPushButton( "Cancel" ); m_install = new QPushButton( "Install" ); buttonLayout->addWidget( m_showSettings ); buttonLayout->addSpacing( 100 ); buttonLayout->addWidget( m_cancel ); buttonLayout->addSpacing( 10 ); buttonLayout->addWidget( m_install ); QObject::connect( m_showSettings, SIGNAL( clicked() ), this, SLOT( showSettings() ) ); QObject::connect( m_install, SIGNAL( clicked() ), this, SLOT( performInstallation() ) ); QObject::connect( m_cancel, SIGNAL( clicked()), this, SLOT( close() ) ); m_tmpFileName = new QString( tmpFileName ); QVBoxLayout *mainLayout = new QVBoxLayout; m_screenStack = new QStackedLayout; //Set up the backend if( fakeRequested ) { m_backend = new FakeBackend( this ); m_fakeRequested = true; } else { m_backend = new Backend; m_fakeRequested = false; } m_header = new MainHeader; m_firstScreen = new FirstScreen( m_backend, m_tmpFileName, filename, this ); Summary *installSummary = new Summary( m_backend, m_tmpFileName ); InstallScreen *installer = new InstallScreen( m_backend, m_tmpFileName ); QScrollArea *scroll = new QScrollArea; scroll->setFrameShape( QFrame::NoFrame ); scroll->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); scroll->setWidget( m_firstScreen ); scroll->setWidgetResizable( true ); m_screenStack->addWidget( scroll ); m_screenStack->addWidget( installSummary ); m_screenStack->addWidget( installer ); m_screenStack->setCurrentIndex( 0 ); mainLayout->addWidget( m_header ); mainLayout->addLayout( m_screenStack ); mainLayout->addSpacing( 5 ); mainLayout->addLayout( m_warningLayout ); mainLayout->addSpacing( 20 ); mainLayout->addLayout( buttonLayout ); setLayout( mainLayout ); setWindowTitle( "One Click Install" ); setWindowIcon( QIcon("/usr/share/icons/hicolor/32x32/apps/oneclickinstall.png") ); QObject::connect( m_firstScreen, SIGNAL( showNextScreen( int ) ), this, SLOT( showNextScreen( int ) ) ); QObject::connect( installSummary, SIGNAL( showNextScreen( int ) ), this, SLOT( showNextScreen( int ) ) ); QObject::connect( m_firstScreen, SIGNAL( countChanged( int, int )), this, SLOT( updateCount( int, int ) ) ); QObject::connect( this, SIGNAL( countChanged( int, int ) ), m_header, SLOT( changeStatusLabel( int, int) ) ); QObject::connect( m_firstScreen, SIGNAL( sizeUpdated( QString ) ), this, SLOT( updateSize( QString ) ) ); QObject::connect( m_backend, SIGNAL( installationStarted() ), m_header, SLOT( installationStarted() ) ); QObject::connect( m_backend, SIGNAL( installationCompleted() ), m_header, SLOT( installationCompleted() ) ); QObject::connect( installer, SIGNAL( installationCompleted() ), m_header, SLOT( installationCompleted() ) ); QObject::connect( m_backend, SIGNAL( installationCompleted() ), installer, SLOT( showCompletionStatus() ) ); show(); }
DetView::DetView(QWidget* p, SequenceObjectContext* ctx) : GSequenceLineViewAnnotated(p, ctx) { editor = new DetViewSequenceEditor(this); showComplementAction = new QAction(tr("Show complementary strand"), this); showComplementAction->setIcon(QIcon(":core/images/show_compl.png")); showComplementAction->setObjectName("complement_action"); connect(showComplementAction, SIGNAL(triggered(bool)), SLOT(sl_showComplementToggle(bool))); showTranslationAction = new QAction(tr("Show/hide translations"), this); showTranslationAction->setObjectName("translation_action"); connect(showTranslationAction, SIGNAL(triggered(bool)), SLOT(sl_showTranslationToggle(bool))); doNotTranslateAction = new QAction(tr("Do not translate"), this); doNotTranslateAction->setObjectName("do_not_translate_radiobutton"); doNotTranslateAction->setData(SequenceObjectContext::TS_DoNotTranslate); connect(doNotTranslateAction, SIGNAL(triggered(bool)), SLOT(sl_doNotTranslate())); doNotTranslateAction->setCheckable(true); doNotTranslateAction->setChecked(true); translateAnnotationsOrSelectionAction = new QAction(tr("Translate selection"), this); translateAnnotationsOrSelectionAction->setData(SequenceObjectContext::TS_AnnotationsOrSelection); connect(translateAnnotationsOrSelectionAction, SIGNAL(triggered(bool)), SLOT(sl_translateAnnotationsOrSelection())); translateAnnotationsOrSelectionAction->setCheckable(true); setUpFramesManuallyAction = new QAction(tr("Set up frames manually"), this); setUpFramesManuallyAction->setObjectName("set_up_frames_manuallt_radiobutton"); setUpFramesManuallyAction->setData(SequenceObjectContext::TS_SetUpFramesManually); connect(setUpFramesManuallyAction, SIGNAL(triggered(bool)), SLOT(sl_setUpFramesManually())); setUpFramesManuallyAction->setCheckable(true); showAllFramesAction = new QAction(tr("Show all frames"), this); showAllFramesAction->setObjectName("show_all_frames_radiobutton"); showAllFramesAction->setData(SequenceObjectContext::TS_ShowAllFrames); connect(showAllFramesAction, SIGNAL(triggered(bool)), SLOT(sl_showAllFrames())); showAllFramesAction->setCheckable(true); wrapSequenceAction = new QAction(tr("Wrap sequence"), this); wrapSequenceAction->setIcon(QIcon(":core/images/wrap_sequence.png")); wrapSequenceAction->setObjectName("wrap_sequence_action"); connect(wrapSequenceAction, SIGNAL(triggered(bool)), SLOT(sl_wrapSequenceToggle(bool))); showComplementAction->setCheckable(true); showTranslationAction->setCheckable(true); wrapSequenceAction->setCheckable(true); wrapSequenceAction->setChecked(true); bool hasComplement = ctx->getComplementTT() != NULL; showComplementAction->setChecked(hasComplement); bool hasAmino = ctx->getAminoTT() != NULL; showTranslationAction->setChecked(hasAmino); assert(ctx->getSequenceObject()!=NULL); featureFlags&=!GSLV_FF_SupportsCustomRange; renderArea = new DetViewRenderArea(this); renderArea->setObjectName("render_area_" + ctx->getSequenceObject()->getSequenceName()); connect(ctx, SIGNAL(si_aminoTranslationChanged()), SLOT(sl_onAminoTTChanged())); connect(ctx, SIGNAL(si_translationRowsChanged()), SLOT(sl_translationRowsChanged())); addActionToLocalToolbar(wrapSequenceAction); if (hasComplement) { addActionToLocalToolbar(showComplementAction); } if (hasAmino) { setupTranslationsMenu(); setupGeneticCodeMenu(); } addActionToLocalToolbar(editor->getEditAction()); verticalScrollBar = new GScrollBar(Qt::Vertical, this); verticalScrollBar->setObjectName("multiline_scrollbar"); scrollBar->setObjectName("singleline_scrollbar"); currentShiftsCounter = 0; numShiftsInOneLine = 1; verticalScrollBar->setHidden(!wrapSequenceAction->isChecked()); scrollBar->setHidden(wrapSequenceAction->isChecked()); pack(); updateActions(); // TODO_SVEDIT: check its required connect(ctx->getSequenceObject(), SIGNAL(si_sequenceChanged()), SLOT(sl_sequenceChanged())); setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); }
GeometryWidget::GeometryWidget(EffectMetaInfo *info, int clipPos, bool showRotation, bool useOffset, QWidget* parent): QWidget(parent), m_monitor(info->monitor), m_timePos(new TimecodeDisplay(info->monitor->timecode())), m_clipPos(clipPos), m_inPoint(0), m_outPoint(1), m_previous(NULL), m_geometry(NULL), m_frameSize(info->frameSize), m_fixedGeom(false), m_singleKeyframe(false), m_useOffset(useOffset) { m_ui.setupUi(this); setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Maximum); connect(m_monitor, &Monitor::effectChanged, this, &GeometryWidget::slotUpdateGeometryRect); connect(m_monitor, &Monitor::effectPointsChanged, this, &GeometryWidget::slotUpdateCenters, Qt::UniqueConnection); /* Setup of timeline and keyframe controls */ ((QGridLayout *)(m_ui.widgetTimeWrapper->layout()))->addWidget(m_timePos, 1, 5); QVBoxLayout *layout = new QVBoxLayout(m_ui.frameTimeline); m_timeline = new KeyframeHelper(m_ui.frameTimeline); layout->addWidget(m_timeline); layout->setContentsMargins(0, 0, 0, 0); int size = style()->pixelMetric(QStyle::PM_SmallIconSize); QSize iconSize(size, size); m_ui.buttonPrevious->setIcon(KoIconUtils::themedIcon(QStringLiteral("media-skip-backward"))); m_ui.buttonPrevious->setToolTip(i18n("Go to previous keyframe")); m_ui.buttonPrevious->setIconSize(iconSize); m_ui.buttonNext->setIcon(KoIconUtils::themedIcon(QStringLiteral("media-skip-forward"))); m_ui.buttonNext->setToolTip(i18n("Go to next keyframe")); m_ui.buttonNext->setIconSize(iconSize); m_ui.buttonAddDelete->setIcon(KoIconUtils::themedIcon(QStringLiteral("list-add"))); m_ui.buttonAddDelete->setToolTip(i18n("Add keyframe")); m_ui.buttonAddDelete->setIconSize(iconSize); connect(m_timeline, SIGNAL(requestSeek(int)), this, SLOT(slotRequestSeek(int))); connect(m_timeline, SIGNAL(keyframeMoved(int)), this, SLOT(slotKeyframeMoved(int))); connect(m_timeline, SIGNAL(addKeyframe(int)), this, SLOT(slotAddKeyframe(int))); connect(m_timeline, SIGNAL(removeKeyframe(int)), this, SLOT(slotDeleteKeyframe(int))); connect(m_timePos, SIGNAL(timeCodeEditingFinished()), this, SLOT(slotPositionChanged())); connect(m_ui.buttonPrevious, SIGNAL(clicked()), this, SLOT(slotPreviousKeyframe())); connect(m_ui.buttonNext, SIGNAL(clicked()), this, SLOT(slotNextKeyframe())); connect(m_ui.buttonAddDelete, SIGNAL(clicked()), this, SLOT(slotAddDeleteKeyframe())); m_spinX = new DragValue(i18nc("x axis position", "X"), 0, 0, -99000, 99000, -1, QString(), false, this); m_ui.horizontalLayout->addWidget(m_spinX, 0, 0); m_spinY = new DragValue(i18nc("y axis position", "Y"), 0, 0, -99000, 99000, -1, QString(), false, this); m_ui.horizontalLayout->addWidget(m_spinY, 0, 1); m_spinWidth = new DragValue(i18nc("Frame width", "W"), m_monitor->render->frameRenderWidth(), 0, 1, 99000, -1, QString(), false, this); m_ui.horizontalLayout->addWidget(m_spinWidth, 0, 2); m_spinHeight = new DragValue(i18nc("Frame height", "H"), m_monitor->render->renderHeight(), 0, 1, 99000, -1, QString(), false, this); m_ui.horizontalLayout->addWidget(m_spinHeight, 0, 3); m_ui.horizontalLayout->setColumnStretch(4, 10); QMenu *menu = new QMenu(this); QAction *originalSize = new QAction(KoIconUtils::themedIcon(QStringLiteral("zoom-original")), i18n("Adjust to original size"), this); connect(originalSize, SIGNAL(triggered()), this, SLOT(slotAdjustToSource())); QAction *adjustSize = new QAction(KoIconUtils::themedIcon(QStringLiteral("zoom-fit-best")), i18n("Adjust and center in frame"), this); connect(adjustSize, SIGNAL(triggered()), this, SLOT(slotAdjustToFrameSize())); QAction *fitToWidth = new QAction(KoIconUtils::themedIcon(QStringLiteral("zoom-fit-width")), i18n("Fit to width"), this); connect(fitToWidth, SIGNAL(triggered()), this, SLOT(slotFitToWidth())); QAction *fitToHeight = new QAction(KoIconUtils::themedIcon(QStringLiteral("zoom-fit-height")), i18n("Fit to height"), this); connect(fitToHeight, SIGNAL(triggered()), this, SLOT(slotFitToHeight())); QAction *importKeyframes = new QAction(i18n("Import keyframes from clip"), this); connect(importKeyframes, SIGNAL(triggered()), this, SIGNAL(importClipKeyframes())); menu->addAction(importKeyframes); QAction *resetKeyframes = new QAction(i18n("Reset all keyframes"), this); connect(resetKeyframes, SIGNAL(triggered()), this, SLOT(slotResetKeyframes())); menu->addAction(resetKeyframes); QAction *resetNextKeyframes = new QAction(i18n("Reset keyframes after cursor"), this); connect(resetNextKeyframes, SIGNAL(triggered()), this, SLOT(slotResetNextKeyframes())); menu->addAction(resetNextKeyframes); QAction *resetPreviousKeyframes = new QAction(i18n("Reset keyframes before cursor"), this); connect(resetPreviousKeyframes, SIGNAL(triggered()), this, SLOT(slotResetPreviousKeyframes())); menu->addAction(resetPreviousKeyframes); menu->addSeparator(); QAction *syncTimeline = new QAction(KoIconUtils::themedIcon(QStringLiteral("edit-link")), i18n("Synchronize with timeline cursor"), this); syncTimeline->setCheckable(true); syncTimeline->setChecked(KdenliveSettings::transitionfollowcursor()); connect(syncTimeline, SIGNAL(toggled(bool)), this, SLOT(slotSetSynchronize(bool))); menu->addAction(syncTimeline); QAction *alignleft = new QAction(KoIconUtils::themedIcon(QStringLiteral("kdenlive-align-left")), i18n("Align left"), this); connect(alignleft, SIGNAL(triggered()), this, SLOT(slotMoveLeft())); QAction *alignhcenter = new QAction(KoIconUtils::themedIcon(QStringLiteral("kdenlive-align-hor")), i18n("Center horizontally"), this); connect(alignhcenter, SIGNAL(triggered()), this, SLOT(slotCenterH())); QAction *alignright = new QAction(KoIconUtils::themedIcon(QStringLiteral("kdenlive-align-right")), i18n("Align right"), this); connect(alignright, SIGNAL(triggered()), this, SLOT(slotMoveRight())); QAction *aligntop = new QAction(KoIconUtils::themedIcon(QStringLiteral("kdenlive-align-top")), i18n("Align top"), this); connect(aligntop, SIGNAL(triggered()), this, SLOT(slotMoveTop())); QAction *alignvcenter = new QAction(KoIconUtils::themedIcon(QStringLiteral("kdenlive-align-vert")), i18n("Center vertically"), this); connect(alignvcenter, SIGNAL(triggered()), this, SLOT(slotCenterV())); QAction *alignbottom = new QAction(KoIconUtils::themedIcon(QStringLiteral("kdenlive-align-bottom")), i18n("Align bottom"), this); connect(alignbottom, SIGNAL(triggered()), this, SLOT(slotMoveBottom())); m_ui.buttonOptions->setMenu(menu); m_ui.buttonOptions->setIcon(KoIconUtils::themedIcon(QStringLiteral("configure"))); m_ui.buttonOptions->setToolTip(i18n("Options")); m_ui.buttonOptions->setIconSize(iconSize); QHBoxLayout *alignLayout = new QHBoxLayout; alignLayout->setSpacing(0); QToolButton *alignButton = new QToolButton; alignButton->setDefaultAction(alignleft); alignButton->setAutoRaise(true); alignLayout->addWidget(alignButton); alignButton = new QToolButton; alignButton->setDefaultAction(alignhcenter); alignButton->setAutoRaise(true); alignLayout->addWidget(alignButton); alignButton = new QToolButton; alignButton->setDefaultAction(alignright); alignButton->setAutoRaise(true); alignLayout->addWidget(alignButton); alignButton = new QToolButton; alignButton->setDefaultAction(aligntop); alignButton->setAutoRaise(true); alignLayout->addWidget(alignButton); alignButton = new QToolButton; alignButton->setDefaultAction(alignvcenter); alignButton->setAutoRaise(true); alignLayout->addWidget(alignButton); alignButton = new QToolButton; alignButton->setDefaultAction(alignbottom); alignButton->setAutoRaise(true); alignLayout->addWidget(alignButton); alignButton = new QToolButton; alignButton->setDefaultAction(originalSize); alignButton->setAutoRaise(true); alignLayout->addWidget(alignButton); alignButton = new QToolButton; alignButton->setDefaultAction(adjustSize); alignButton->setAutoRaise(true); alignLayout->addWidget(alignButton); alignButton = new QToolButton; alignButton->setDefaultAction(fitToWidth); alignButton->setAutoRaise(true); alignLayout->addWidget(alignButton); alignButton = new QToolButton; alignButton->setDefaultAction(fitToHeight); alignButton->setAutoRaise(true); alignLayout->addWidget(alignButton); alignLayout->addStretch(10); m_ui.horizontalLayout->addLayout(alignLayout, 1, 0, 1, 4); //m_ui.horizontalLayout->addStretch(10); m_spinSize = new DragValue(i18n("Size"), 100, 2, 1, 99000, -1, i18n("%"), false, this); m_ui.horizontalLayout2->addWidget(m_spinSize); m_opacity = new DragValue(i18n("Opacity"), 100, 0, 0, 100, -1, i18n("%"), true, this); m_ui.horizontalLayout2->addWidget(m_opacity); if (showRotation) { m_rotateX = new DragValue(i18n("Rotate X"), 0, 0, -1800, 1800, -1, QString(), true, this); m_rotateX->setObjectName(QStringLiteral("rotate_x")); m_ui.horizontalLayout3->addWidget(m_rotateX); m_rotateY = new DragValue(i18n("Rotate Y"), 0, 0, -1800, 1800, -1, QString(), true, this); m_rotateY->setObjectName(QStringLiteral("rotate_y")); m_ui.horizontalLayout3->addWidget(m_rotateY); m_rotateZ = new DragValue(i18n("Rotate Z"), 0, 0, -1800, 1800, -1, QString(), true, this); m_rotateZ->setObjectName(QStringLiteral("rotate_z")); m_ui.horizontalLayout3->addWidget(m_rotateZ); connect(m_rotateX, SIGNAL(valueChanged(double)), this, SLOT(slotUpdateGeometry())); connect(m_rotateY, SIGNAL(valueChanged(double)), this, SLOT(slotUpdateGeometry())); connect(m_rotateZ, SIGNAL(valueChanged(double)), this, SLOT(slotUpdateGeometry())); } /* Setup of geometry controls */ connect(m_spinX, SIGNAL(valueChanged(double)), this, SLOT(slotSetX(double))); connect(m_spinY, SIGNAL(valueChanged(double)), this, SLOT(slotSetY(double))); connect(m_spinWidth, SIGNAL(valueChanged(double)), this, SLOT(slotSetWidth(double))); connect(m_spinHeight, SIGNAL(valueChanged(double)), this, SLOT(slotSetHeight(double))); connect(m_spinSize, SIGNAL(valueChanged(double)), this, SLOT(slotResize(double))); connect(m_opacity, SIGNAL(valueChanged(double)), this, SLOT(slotSetOpacity(double))); /*connect(m_ui.buttonMoveLeft, SIGNAL(clicked()), this, SLOT(slotMoveLeft())); connect(m_ui.buttonCenterH, SIGNAL(clicked()), this, SLOT(slotCenterH())); connect(m_ui.buttonMoveRight, SIGNAL(clicked()), this, SLOT(slotMoveRight())); connect(m_ui.buttonMoveTop, SIGNAL(clicked()), this, SLOT(slotMoveTop())); connect(m_ui.buttonCenterV, SIGNAL(clicked()), this, SLOT(slotCenterV())); connect(m_ui.buttonMoveBottom, SIGNAL(clicked()), this, SLOT(slotMoveBottom()));*/ /* Setup of configuration controls */ connect(m_monitor, SIGNAL(addKeyframe()), this, SLOT(slotAddKeyframe())); connect(m_monitor, SIGNAL(seekToKeyframe(int)), this, SLOT(slotSeekToKeyframe(int))); connect(this, SIGNAL(parameterChanged()), this, SLOT(slotUpdateProperties())); }
ATCMtime::ATCMtime(QWidget *parent) : QPushButton(parent) { m_format = DEFAULT_TIME; m_bgcolor = BG_COLOR_DEF; m_bgcolor_select = BG_COLOR_SEL_DEF; m_fontcolor = FONT_COLOR_DEF; m_fontcolor_select = FONT_COLOR_SEL_DEF; m_bordercolor = BORDER_COLOR_DEF; m_bordercolor_select = BORDER_COLOR_SEL_DEF; m_borderwidth = BORDER_WIDTH_DEF; m_borderradius = BORDER_RADIUS_DEF; //setMinimumSize(QSize(150,50)); setFocusPolicy(Qt::NoFocus); setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); setFlat(true); setStyle(new ATCMStyle); #ifdef TARGET_ARM setToolTip(""); #endif /* * put there a default stylesheet */ setStyleSheet( #ifndef ENABLE_STYLESHEET "" #else "/* property into normal status */\n" "QPushButton {\n" " /* set the border width and color */\n" " /*border:2px solid black;*/\n" " /* set the border radius */\n" " /*border-radius:4px;*/\n" " /* set the background image */\n" " /*background-image: url();*/\n" " /* set the image */\n" " /*image: url();*/\n" " /* set the icon image */\n" " /*qproperty-icon: url();*/\n" " /* set the icon image size */\n" " /*qproperty-iconSize: 24px;*/\n" " /* set the background color */\n" " /*background-color: rgb(230, 230, 230);*/\n" " /* set the text at normal status */\n" " /*qproperty-text: \"text\";*/\n" " /* set the font color */\n" " /*color: black;*/\n" "}\n" "/* property into pressed status */\n" "QPushButton:pressed {\n" " /* set the background color */\n" " /*background-color: rgb(230, 230, 130);*/\n" " /* set the border width and color */\n" " /*border:2px solid black;*/\n" " /* set the border radius */\n" " /*border-radius:4px;*/\n" " /* set the text at pressed status */\n" " /*qproperty-text: \"text pressed\";*/\n" " /* set the font color */\n" " /*color: black;*/\n" " /* set the background image */\n" " /*background-image: url();*/\n" " /* set the image */\n" " /*image: url();*/\n" " /* set the icon image */\n" " /*qproperty-icon: url();*/\n" " /* set the icon image size */\n" " /*qproperty-iconSize: 24px;*/\n" "}\n" "/* property into disabled status */\n" "QPushButton:disabled {\n" " /* set the background color */\n" " /*background-color: rgb(255, 255, 255);*/\n" " /* set the border width and color */\n" " /*border:2px solid black;*/\n" " /* set the border radius */\n" " /*border-radius:4px;*/\n" " /* set the text at pressed status */\n" " /*qproperty-text: \"text disabled\";*/\n" " /* set the font color */\n" " /*color: rgb(155, 155, 155);*/\n" " /* set the background image */\n" " /*background-image: url();*/\n" " /* set the image */\n" " /*image: url();*/\n" " /* set the icon image */\n" " /*qproperty-icon: url();*/\n" " /* set the icon image size */\n" " /*qproperty-iconSize: 24px;*/\n" "}\n" #endif ); refresh_timer = new QTimer(this); connect(refresh_timer, SIGNAL(timeout()), this, SLOT(updateData())); refresh_timer->start(500); }
QgsLocatorWidget::QgsLocatorWidget( QWidget *parent ) : QWidget( parent ) , mModelBridge( new QgsLocatorModelBridge( this ) ) , mLineEdit( new QgsFilterLineEdit() ) , mResultsView( new QgsLocatorResultsView() ) { mLineEdit->setShowClearButton( true ); #ifdef Q_OS_MACX mLineEdit->setPlaceholderText( tr( "Type to locate (⌘K)" ) ); #else mLineEdit->setPlaceholderText( tr( "Type to locate (Ctrl+K)" ) ); #endif int placeholderMinWidth = mLineEdit->fontMetrics().width( mLineEdit->placeholderText() ); int minWidth = std::max( 200, static_cast< int >( placeholderMinWidth * 1.8 ) ); resize( minWidth, 30 ); QSizePolicy sizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Preferred ); sizePolicy.setHorizontalStretch( 0 ); sizePolicy.setVerticalStretch( 0 ); setSizePolicy( sizePolicy ); setMinimumSize( QSize( minWidth, 0 ) ); QHBoxLayout *layout = new QHBoxLayout(); layout->setMargin( 0 ); layout->setContentsMargins( 0, 0, 0, 0 ); layout->addWidget( mLineEdit ); setLayout( layout ); setFocusProxy( mLineEdit ); // setup floating container widget mResultsContainer = new QgsFloatingWidget( parent ? parent->window() : nullptr ); mResultsContainer->setAnchorWidget( mLineEdit ); mResultsContainer->setAnchorPoint( QgsFloatingWidget::BottomLeft ); mResultsContainer->setAnchorWidgetPoint( QgsFloatingWidget::TopLeft ); QHBoxLayout *containerLayout = new QHBoxLayout(); containerLayout->setMargin( 0 ); containerLayout->setContentsMargins( 0, 0, 0, 0 ); containerLayout->addWidget( mResultsView ); mResultsContainer->setLayout( containerLayout ); mResultsContainer->hide(); mResultsView->setModel( mModelBridge->proxyModel() ); mResultsView->setUniformRowHeights( true ); mResultsView->setIconSize( QSize( 16, 16 ) ); mResultsView->recalculateSize(); mResultsView->setContextMenuPolicy( Qt::CustomContextMenu ); connect( mLineEdit, &QLineEdit::textChanged, this, &QgsLocatorWidget::scheduleDelayedPopup ); connect( mResultsView, &QAbstractItemView::activated, this, &QgsLocatorWidget::acceptCurrentEntry ); connect( mResultsView, &QAbstractItemView::customContextMenuRequested, this, &QgsLocatorWidget::showContextMenu ); connect( mModelBridge, &QgsLocatorModelBridge::resultAdded, this, &QgsLocatorWidget::resultAdded ); connect( mModelBridge, &QgsLocatorModelBridge::isRunningChanged, this, [ = ]() {mLineEdit->setShowSpinner( mModelBridge->isRunning() );} ); connect( mModelBridge, & QgsLocatorModelBridge::resultsCleared, this, [ = ]() {mHasSelectedResult = false;} ); // have a tiny delay between typing text in line edit and showing the window mPopupTimer.setInterval( 100 ); mPopupTimer.setSingleShot( true ); connect( &mPopupTimer, &QTimer::timeout, this, &QgsLocatorWidget::performSearch ); mFocusTimer.setInterval( 110 ); mFocusTimer.setSingleShot( true ); connect( &mFocusTimer, &QTimer::timeout, this, &QgsLocatorWidget::triggerSearchAndShowList ); mLineEdit->installEventFilter( this ); mResultsContainer->installEventFilter( this ); mResultsView->installEventFilter( this ); installEventFilter( this ); window()->installEventFilter( this ); mModelBridge->locator()->registerFilter( new QgsLocatorFilterFilter( this, this ) ); mMenu = new QMenu( this ); QAction *menuAction = mLineEdit->addAction( QgsApplication::getThemeIcon( QStringLiteral( "/search.svg" ) ), QLineEdit::LeadingPosition ); connect( menuAction, &QAction::triggered, this, [ = ] { mFocusTimer.stop(); mResultsContainer->hide(); mMenu->exec( QCursor::pos() ); } ); connect( mMenu, &QMenu::aboutToShow, this, &QgsLocatorWidget::configMenuAboutToShow ); }
KSqueezedTextLabel::KSqueezedTextLabel( const TQString &text , TQWidget *parent, const char *name ) : TQLabel ( parent, name ) { setSizePolicy(TQSizePolicy( TQSizePolicy::Expanding, TQSizePolicy::Fixed )); fullText = text; squeezeTextToLabel(); }
MyWidget() { setAttribute( Qt::WA_NoSystemBackground ); setSizePolicy( QSizePolicy::Ignored, QSizePolicy::Preferred ); }
KSqueezedTextLabel::KSqueezedTextLabel( TQWidget *parent, const char *name ) : TQLabel ( parent, name ) { setSizePolicy(TQSizePolicy( TQSizePolicy::Expanding, TQSizePolicy::Fixed )); }
QToolBarSeparator::QToolBarSeparator(QToolBar *parent) : QWidget(parent), orient(parent->orientation()) { setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); }
/* * Constructs a DialerBase which is a child of 'parent', with the * name 'name' and widget flags set to 'f' * * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ DialerBase::DialerBase( QWidget* parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, modal, fl ) { if ( !name ) setName( "DialerBase" ); resize( 232, 149 ); setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, sizePolicy().hasHeightForWidth() ) ); setCaption( i18n( "Dialer" ) ); setSizeGripEnabled( FALSE ); DialerBaseLayout = new QVBoxLayout( this ); DialerBaseLayout->setSpacing( 6 ); DialerBaseLayout->setMargin( 11 ); m_switcher = new QWidgetStack( this, "m_switcher" ); m_switcher->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, m_switcher->sizePolicy().hasHeightForWidth() ) ); m_infos = new QFrame( m_switcher, "m_infos" ); m_infos->setGeometry( QRect( 11, 11, 195, 64 ) ); m_infos->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, m_infos->sizePolicy().hasHeightForWidth() ) ); m_infos->setFrameShape( QFrame::NoFrame ); m_infos->setFrameShadow( QFrame::Raised ); m_infosLayout = new QVBoxLayout( m_infos ); m_infosLayout->setSpacing( 6 ); m_infosLayout->setMargin( 0 ); m_label1 = new QLabel( m_infos, "m_label1" ); m_label1->setText( i18n( "You are currently not connected" ) ); m_infosLayout->addWidget( m_label1 ); m_label2 = new QLabel( m_infos, "m_label2" ); m_label2->setText( i18n( "Choose account to dial:" ) ); m_infosLayout->addWidget( m_label2 ); m_which = new QComboBox( FALSE, m_infos, "m_which" ); m_infosLayout->addWidget( m_which ); DialerBaseLayout->addWidget( m_switcher ); Layout1 = new QHBoxLayout; Layout1->setSpacing( 6 ); Layout1->setMargin( 0 ); QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); Layout1->addItem( spacer ); m_action = new QPushButton( this, "m_action" ); m_action->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, m_action->sizePolicy().hasHeightForWidth() ) ); m_action->setMinimumSize( QSize( 88, 0 ) ); m_action->setText( QString::null ); m_action->setOn( FALSE ); m_action->setDefault( FALSE ); m_action->setOn( FALSE ); m_action->setFlat( FALSE ); Layout1->addWidget( m_action ); QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); Layout1->addItem( spacer_2 ); m_close = new QPushButton( this, "m_close" ); m_close->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, m_close->sizePolicy().hasHeightForWidth() ) ); m_close->setMinimumSize( QSize( 88, 0 ) ); m_close->setText( i18n( "Close" ) ); Layout1->addWidget( m_close ); QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); Layout1->addItem( spacer_3 ); DialerBaseLayout->addLayout( Layout1 ); // signals and slots connections connect( m_action, SIGNAL( clicked() ), this, SLOT( accept() ) ); connect( m_close, SIGNAL( clicked() ), this, SLOT( reject() ) ); // tab order setTabOrder( m_action, m_close ); }
VirtualClusterLineEdit::VirtualClusterLineEdit(QWidget* pParent, const char* pTabName, const char* pIdColumn, const char* pNumberColumn, const char* pNameColumn, const char* pDescripColumn, const char* pExtra, const char* pName, const char* pActiveColumn) : XLineEdit(pParent, pName) { if (DEBUG) qDebug("VirtualClusterLineEdit(%p, %s, %s, %s, %s, %s, %s, %s, %s)", pParent ? pParent : 0, pTabName ? pTabName : "", pIdColumn ? pIdColumn : "", pNumberColumn ? pNumberColumn : "", pNameColumn ? pNameColumn : "", pDescripColumn ? pDescripColumn : "", pExtra ? pExtra : "", pName ? pName : "", pActiveColumn ? pActiveColumn : ""); setObjectName(pName ? pName : "VirtualClusterLineEdit"); _valid = false; _parsed = true; _strict = true; setTableAndColumnNames(pTabName, pIdColumn, pNumberColumn, pNameColumn, pDescripColumn, pActiveColumn); if (pExtra && QString(pExtra).trimmed().length()) _extraClause = pExtra; setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); clear(); _titleSingular = tr("Object"); _titlePlural = tr("Objects"); // Completer set up if (_x_metrics) { if (!_x_metrics->boolean("DisableAutoComplete")) { QSqlQueryModel* hints = new QSqlQueryModel(this); _completer = new QCompleter(hints,this); _completer->setWidget(this); QTreeView* view = new QTreeView(this); view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); view->setHeaderHidden(true); view->setRootIsDecorated(false); _completer->setPopup(view); _completer->setCaseSensitivity(Qt::CaseInsensitive); _completer->setCompletionColumn(1); _completer->setModelSorting(QCompleter::CaseInsensitivelySortedModel); connect(this, SIGNAL(textEdited(QString)), this, SLOT(sHandleCompleter())); connect(_completer, SIGNAL(highlighted(QString)), this, SLOT(setText(QString))); } } // Set up actions connect(_listAct, SIGNAL(triggered()), this, SLOT(sList())); connect(_searchAct, SIGNAL(triggered()), this, SLOT(sSearch())); _infoAct = new QAction(tr("Info..."), this); _infoAct->setShortcut(QKeySequence(tr("Ctrl+Alt+I"))); _infoAct->setShortcutContext(Qt::WidgetWithChildrenShortcut); _infoAct->setToolTip(tr("View record information")); _infoAct->setEnabled(false); connect(_infoAct, SIGNAL(triggered()), this, SLOT(sInfo())); addAction(_infoAct); _openAct = new QAction(tr("Open..."), this); _openAct->setShortcut(QKeySequence(tr("Ctrl+Alt+O"))); _openAct->setShortcutContext(Qt::WidgetWithChildrenShortcut); _openAct->setToolTip(tr("Open record detail")); _openAct->setEnabled(false); connect(_openAct, SIGNAL(triggered()), this, SLOT(sOpen())); addAction(_openAct); _newAct = new QAction(tr("New..."), this); _newAct->setShortcut(QKeySequence(tr("Ctrl+Alt+N"))); _newAct->setShortcutContext(Qt::WidgetWithChildrenShortcut); _newAct->setToolTip(tr("Create new record")); _newAct->setEnabled(false); connect(_newAct, SIGNAL(triggered()), this, SLOT(sNew())); addAction(_newAct); connect(this, SIGNAL(valid(bool)), _infoAct, SLOT(setEnabled(bool))); _menuLabel = new QLabel(this); // Menu set up if (_x_preferences) { if (!_x_preferences->boolean("ClusterButtons")) { _menu = 0; _menuLabel->setPixmap(QPixmap(":/widgets/images/magnifier.png")); _menuLabel->installEventFilter(this); int height = minimumSizeHint().height(); QString sheet = QLatin1String("QLineEdit{ padding-right: "); sheet += QString::number(_menuLabel->pixmap()->width() + 6); sheet += QLatin1String(";}"); setStyleSheet(sheet); // Little hack. Somehow style sheet makes widget short. Put back height. setMinimumHeight(height); // Set default menu with standard actions QMenu* menu = new QMenu; menu->addAction(_listAct); menu->addAction(_searchAct); menu->addSeparator(); menu->addAction(_infoAct); setMenu(menu); connect(this, SIGNAL(valid(bool)), this, SLOT(sUpdateMenu())); connect(menu, SIGNAL(aboutToShow()), this, SLOT(sUpdateMenu())); } }
ZLQtPreviewWidget::ZLQtPreviewWidget(QWidget *parent) : QWidget(parent), myCurrentNode(0) { QSizePolicy policy = QSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding); //policy.setHorizontalStretch(2); setSizePolicy(policy); }
EventView::EventView(QWidget *parent) : QDialog(parent) , m_toolBar(new QToolBar(this)) , m_actionUndo(this) , m_actionRedo(this) , m_actionNewEvent(this) , m_actionEditEvent(this) , m_actionDeleteEvent(this) , m_actionCreateTimeSheet(this) , m_actionFindAndReplace(this) , m_comboBox(new QComboBox(this)) , m_labelTotal(new QLabel(this)) , m_listView(new QListView(this)) { setWindowTitle(tr("Event Editor")); auto layout = new QVBoxLayout(this); layout->setMargin(0); layout->setSpacing(0); layout->addWidget(m_toolBar); layout->addWidget(m_listView); m_listView->setAlternatingRowColors(true); m_listView->setContextMenuPolicy(Qt::CustomContextMenu); connect(m_listView, &QListView::customContextMenuRequested, this, &EventView::slotContextMenuRequested); connect(m_listView, &QListView::doubleClicked, this, &EventView::slotEventDoubleClicked); connect(&m_actionNewEvent, &QAction::triggered, this, &EventView::slotNewEvent); connect(&m_actionEditEvent, SIGNAL(triggered()), SLOT(slotEditEvent())); connect(&m_actionDeleteEvent, &QAction::triggered, this, &EventView::slotDeleteEvent); // connect( &m_commitTimer, SIGNAL(timeout()), // SLOT(slotCommitTimeout()) ); // m_commitTimer.setSingleShot( true ); m_actionUndo.setText(tr("Undo")); m_actionUndo.setToolTip(tr("Undo the latest change")); m_actionUndo.setShortcut(QKeySequence::Undo); m_actionUndo.setEnabled(false); m_actionRedo.setText(tr("Redo")); m_actionRedo.setToolTip(tr("Redo the last undone change.")); m_actionRedo.setShortcut(QKeySequence::Redo); m_actionRedo.setEnabled(false); m_undoStack = new QUndoStack(this); connect(m_undoStack, &QUndoStack::canUndoChanged, &m_actionUndo, &QAction::setEnabled); connect(m_undoStack, &QUndoStack::undoTextChanged, this, &EventView::slotUndoTextChanged); connect(&m_actionUndo, &QAction::triggered, m_undoStack, &QUndoStack::undo); connect(m_undoStack, &QUndoStack::canRedoChanged, &m_actionRedo, &QAction::setEnabled); connect(m_undoStack, &QUndoStack::redoTextChanged, this, &EventView::slotRedoTextChanged); connect(&m_actionRedo, &QAction::triggered, m_undoStack, &QUndoStack::redo); m_actionNewEvent.setText(tr("New Event...")); m_actionNewEvent.setToolTip(tr("Create a new Event")); m_actionNewEvent.setIcon(Data::newTaskIcon()); m_actionNewEvent.setShortcut(QKeySequence::New); m_toolBar->addAction(&m_actionNewEvent); m_actionEditEvent.setText(tr("Edit Event...")); m_actionEditEvent.setShortcut(Qt::CTRL + Qt::Key_E); m_actionEditEvent.setIcon(Data::editEventIcon()); m_toolBar->addAction(&m_actionEditEvent); m_actionFindAndReplace.setText(tr("Search/Replace Events...")); m_actionFindAndReplace.setToolTip(tr("Change the task events belong to")); m_actionFindAndReplace.setIcon(Data::searchIcon()); m_toolBar->addAction(&m_actionFindAndReplace); connect(&m_actionFindAndReplace, &QAction::triggered, this, &EventView::slotFindAndReplace); m_actionDeleteEvent.setText(tr("Delete Event...")); QList<QKeySequence> deleteShortcuts; deleteShortcuts << QKeySequence::Delete; #ifdef Q_OS_OSX deleteShortcuts << Qt::Key_Backspace; #endif m_actionDeleteEvent.setShortcuts(deleteShortcuts); m_actionDeleteEvent.setIcon(Data::deleteTaskIcon()); m_toolBar->addAction(&m_actionDeleteEvent); // disable all actions, action state will be set when the current // item changes: m_actionNewEvent.setEnabled(true); // always on m_actionEditEvent.setEnabled(false); m_actionDeleteEvent.setEnabled(false); m_toolBar->addWidget(m_comboBox); connect(m_comboBox, SIGNAL(currentIndexChanged(int)), SLOT(timeFrameChanged(int))); auto spacer = new QWidget(this); QSizePolicy spacerSizePolicy = spacer->sizePolicy(); spacerSizePolicy.setHorizontalPolicy(QSizePolicy::Expanding); spacer->setSizePolicy(spacerSizePolicy); m_toolBar->addWidget(spacer); m_toolBar->addWidget(m_labelTotal); QTimer::singleShot(0, this, SLOT(delayedInitialization())); // I hate doing this but the stupid default view sizeHints suck badly. setMinimumHeight(200); }
PropertiesPalette_XYZ::PropertiesPalette_XYZ( QWidget* parent) : QWidget(parent) { m_ScMW=0; m_doc=0; m_haveDoc = false; m_haveItem = false; m_lineMode = false; m_oldRotation = 0; m_unitRatio = 1.0; setupUi(this); setSizePolicy( QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum)); _userActionOn = false; userActionSniffer = new UserActionSniffer(this); connect(userActionSniffer, SIGNAL(actionStart()), this, SLOT(spinboxStartUserAction())); connect(userActionSniffer, SIGNAL(actionEnd()), this, SLOT(spinboxFinishUserAction())); nameEdit->setFocusPolicy(Qt::ClickFocus); installSniffer(xposSpin); installSniffer(yposSpin); installSniffer(widthSpin); installSniffer(heightSpin); xposLabel->setBuddy(xposSpin); yposLabel->setBuddy(yposSpin); widthLabel->setBuddy(widthSpin); heightLabel->setBuddy(heightSpin); keepFrameWHRatioButton->setCheckable( true ); keepFrameWHRatioButton->setAutoRaise( true ); keepFrameWHRatioButton->setMaximumSize( QSize( 15, 32767 ) ); keepFrameWHRatioButton->setChecked(false); rotationSpin->setWrapping( true ); installSniffer(rotationSpin); rotationSpin->setNewUnit(6); rotationLabel->setBuddy(rotationSpin); levelUp->setIcon(QIcon(loadIcon("16/go-up.png"))); levelDown->setIcon(QIcon(loadIcon("16/go-down.png"))); levelTop->setIcon(QIcon(loadIcon("16/go-top.png"))); levelBottom->setIcon(QIcon(loadIcon("16/go-bottom.png"))); levelLabel->setAlignment( Qt::AlignCenter ); doGroup->setIcon(QIcon(loadIcon("group.png"))); doUnGroup->setIcon(QIcon(loadIcon("ungroup.png"))); flipH->setIcon(QIcon(loadIcon("16/flip-object-horizontal.png"))); flipH->setCheckable( true ); flipV->setIcon(QIcon(loadIcon("16/flip-object-vertical.png"))); flipV->setCheckable( true ); doLock->setCheckable( true ); QIcon a = QIcon(); a.addPixmap(loadIcon("16/lock.png"), QIcon::Normal, QIcon::On); a.addPixmap(loadIcon("16/lock-unlocked.png"), QIcon::Normal, QIcon::Off); doLock->setIcon(a); noPrint->setCheckable( true ); QIcon a2 = QIcon(); a2.addPixmap(loadIcon("NoPrint.png"), QIcon::Normal, QIcon::On); a2.addPixmap(loadIcon("16/document-print.png"), QIcon::Normal, QIcon::Off); noPrint->setIcon(a2); noResize->setCheckable( true ); QIcon a3 = QIcon(); a3.addPixmap(loadIcon("framenoresize.png"), QIcon::Normal, QIcon::On); a3.addPixmap(loadIcon("frameresize.png"), QIcon::Normal, QIcon::Off); noResize->setIcon(a3); m_lineMode = false; languageChange(); connect(xposSpin, SIGNAL(valueChanged(double)), this, SLOT(handleNewX())); connect(yposSpin, SIGNAL(valueChanged(double)), this, SLOT(handleNewY())); connect(widthSpin, SIGNAL(valueChanged(double)), this, SLOT(handleNewW())); connect(heightSpin, SIGNAL(valueChanged(double)), this, SLOT(handleNewH())); connect(rotationSpin, SIGNAL(valueChanged(double)), this, SLOT(handleRotation())); connect(flipH, SIGNAL(clicked()), this, SLOT(handleFlipH())); connect(flipV, SIGNAL(clicked()), this, SLOT(handleFlipV())); connect(levelUp, SIGNAL(clicked()), this, SLOT(handleRaise())); connect(levelDown, SIGNAL(clicked()), this, SLOT(handleLower())); connect(levelTop, SIGNAL(clicked()), this, SLOT(handleFront())); connect(levelBottom, SIGNAL(clicked()), this, SLOT(handleBack())); connect(basePointWidget, SIGNAL(buttonClicked(int)), this, SLOT(handleBasePoint(int))); connect(nameEdit , SIGNAL(Leaved()) , this, SLOT(handleNewName())); connect(doLock , SIGNAL(clicked()), this, SLOT(handleLock())); connect(noPrint , SIGNAL(clicked()), this, SLOT(handlePrint())); connect(noResize , SIGNAL(clicked()), this, SLOT(handleLockSize())); connect(doGroup , SIGNAL(clicked()), this, SLOT(handleGrouping()) ); connect(doUnGroup, SIGNAL(clicked()), this, SLOT(handleUngrouping()) ); m_haveItem = false; xposSpin->showValue(0); yposSpin->showValue(0); widthSpin->showValue(0); heightSpin->showValue(0); rotationSpin->showValue(0); }
CollectionSetup::CollectionSetup( QWidget *parent ) : QWidget( parent ) , m_rescanDirAction( new QAction( this ) ) { m_ui.setupUi(this); setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); setObjectName( "CollectionSetup" ); s_instance = this; if( KGlobalSettings::graphicEffectsLevel() != KGlobalSettings::NoEffects ) m_ui.view->setAnimated( true ); connect( m_ui.view, SIGNAL(clicked(QModelIndex)), this, SIGNAL(changed()) ); connect( m_ui.view, SIGNAL(pressed(QModelIndex)), this, SLOT(slotPressed(QModelIndex)) ); connect( m_rescanDirAction, SIGNAL(triggered()), this, SLOT(slotRescanDirTriggered()) ); KPushButton *rescan = new KPushButton( KIcon( "collection-rescan-amarok" ), i18n( "Full rescan" ), m_ui.buttonContainer ); rescan->setToolTip( i18n( "Rescan your entire collection. This will <i>not</i> delete any statistics." ) ); connect( rescan, SIGNAL(clicked()), CollectionManager::instance(), SLOT(startFullScan()) ); KPushButton *import = new KPushButton( KIcon( "tools-wizard" ), i18n( "Import" ), m_ui.buttonContainer ); import->setToolTip( i18n( "Import collection and/or statistics from older Amarok versions, the batch scanner or media players." ) ); connect( import, SIGNAL(clicked()), this, SLOT(importCollection()) ); QHBoxLayout *buttonLayout = new QHBoxLayout(); buttonLayout->addWidget( rescan ); buttonLayout->addWidget( import ); m_ui.buttonContainer->setLayout( buttonLayout ); m_recursive = new QCheckBox( i18n("&Scan folders recursively (requires full rescan if newly checked)"), m_ui.checkboxContainer ); m_monitor = new QCheckBox( i18n("&Watch folders for changes"), m_ui.checkboxContainer ); connect( m_recursive, SIGNAL(toggled(bool)), this, SIGNAL(changed()) ); connect( m_monitor , SIGNAL(toggled(bool)), this, SIGNAL(changed()) ); QVBoxLayout *checkboxLayout = new QVBoxLayout(); checkboxLayout->addWidget( m_recursive ); checkboxLayout->addWidget( m_monitor ); m_ui.checkboxContainer->setLayout( checkboxLayout ); m_recursive->setToolTip( i18n( "If selected, Amarok will read all subfolders." ) ); m_monitor->setToolTip( i18n( "If selected, the collection folders will be watched " "for changes.\nThe watcher will not notice changes behind symbolic links." ) ); m_recursive->setChecked( AmarokConfig::scanRecursively() ); m_monitor->setChecked( AmarokConfig::monitorChanges() ); // set the model _after_ constructing the checkboxes m_model = new CollectionFolder::Model( this ); m_ui.view->setModel( m_model ); #ifndef Q_OS_WIN m_ui.view->setRootIndex( m_model->setRootPath( QDir::rootPath() ) ); #else m_ui.view->setRootIndex( m_model->setRootPath( m_model->myComputer().toString() ) ); #endif Collections::Collection *primaryCollection = CollectionManager::instance()->primaryCollection(); QStringList dirs = primaryCollection ? primaryCollection->property( "collectionFolders" ).toStringList() : QStringList(); m_model->setDirectories( dirs ); // make sure that the tree is expanded to show all selected items foreach( const QString &dir, dirs ) { QModelIndex index = m_model->index( dir ); m_ui.view->scrollTo( index, QAbstractItemView::EnsureVisible ); }
LinearView::LinearView(QWidget *parent) : QAbstractItemView(parent) { setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); }