void VirtualClusterLineEdit::sEllipses() { if (_x_preferences && _x_preferences->value("DefaultEllipsesAction") == "search") sSearch(); else sList(); }
WorkCenterCluster::WorkCenterCluster(QWidget * parent, const char * name) : QWidget(parent, name) { QHBoxLayout *layout = new QHBoxLayout(this); layout->setMargin(0); layout->setSpacing(0); _label = new QLabel(tr("Work Center:"), this); _label->setAlignment(Qt::AlignVCenter | Qt::AlignRight); layout->addWidget(_label); _workcenter = new WorkCenterLineEdit(this); layout->addWidget(_workcenter); _list = new QPushButton(tr("..."), this); _list->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); #ifdef Q_WS_MAC _list->setMaximumWidth(50); #else _list->setMaximumWidth(25); #endif _list->setFocusPolicy(Qt::NoFocus); layout->addWidget(_list); QSpacerItem * spacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Fixed); layout->addItem(spacer); setLayout(layout); connect(_list, SIGNAL(clicked()), this, SLOT(sList())); connect(_workcenter, SIGNAL(newId(int)), this, SIGNAL(newId(int))); connect(_workcenter, SIGNAL(valid(bool)), this, SIGNAL(valid(bool))); setFocusProxy(_workcenter); }
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) : XLineEdit(pParent, pName) { _valid = false; _parsed = true; _strict = true; setTableAndColumnNames(pTabName, pIdColumn, pNumberColumn, pNameColumn, pDescripColumn); if (pExtra && QString(pExtra).stripWhiteSpace().length()) _extraClause = pExtra; connect(this, SIGNAL(lostFocus()), this, SLOT(sParse())); connect(this, SIGNAL(requestInfo()), this, SLOT(sInfo())); connect(this, SIGNAL(requestList()), this, SLOT(sList())); connect(this, SIGNAL(requestSearch()), this, SLOT(sSearch())); setAlignment(Qt::AlignLeft | Qt::AlignVCenter); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); setMaximumWidth(100); clear(); _titleSingular = tr("Object"); _titlePlural = tr("Objects"); }
void ContactCluster::sEllipses() { if (_x_preferences && _x_preferences->value("DefaultEllipsesAction") == "search") sSearch(); else sList(); }
void SoCluster::constructor() { QVBoxLayout *_layoutMain = new QVBoxLayout(this); _layoutMain->setMargin(0); _layoutMain->setSpacing(5); QWidget * _layoutOrderNumberWidget = new QWidget(this); QHBoxLayout *_layoutOrderNumber = new QHBoxLayout(_layoutOrderNumberWidget); _layoutOrderNumber->setMargin(0); _layoutOrderNumber->setSpacing(5); QLabel *_soNumberLit = new QLabel(tr("Sales Order #:"), _layoutOrderNumberWidget, "_soNumberLit"); _soNumberLit->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); _soNumberLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _layoutOrderNumber->addWidget(_soNumberLit); _soNumber = new SoLineEdit(_layoutOrderNumberWidget); _soNumber->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); _layoutOrderNumber->addWidget(_soNumber); _list = new QPushButton(tr("..."), _layoutOrderNumberWidget, "_list"); _list->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); #ifdef Q_WS_MAC _list->setMaximumWidth(50); #else _list->setMaximumWidth(25); #endif _list->setFocusPolicy(Qt::NoFocus); _layoutOrderNumber->addWidget(_list); _layoutOrderNumberWidget->setLayout(_layoutOrderNumber); _layoutMain->addWidget(_layoutOrderNumberWidget); _custName = new QLabel(this, "_custName"); _custName->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); _custName->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _layoutMain->addWidget(_custName); setLayout(_layoutMain); connect(_list, SIGNAL(clicked()), this, SLOT(sList())); connect(_soNumber, SIGNAL(requestList()), SLOT(sList())); connect(_soNumber, SIGNAL(custNameChanged(const QString &)), _custName, SLOT(setText(const QString &))); connect(_soNumber, SIGNAL(newId(int)), this, SIGNAL(newId(int))); connect(_soNumber, SIGNAL(custidChanged(int)), this, SIGNAL(newCustid(int))); connect(_soNumber, SIGNAL(valid(bool)), this, SIGNAL(valid(bool))); setFocusProxy(_soNumber); }
void VendorLineEdit::sEllipses() { if(_x_preferences) { if(_x_preferences->value("DefaultEllipsesAction") == "search") { sSearch(); return; } } sList(); }
PoCluster::PoCluster(QWidget *parent, const char *name) : QWidget(parent, name) { // Create the component Widgets QVBoxLayout *layoutMain = new QVBoxLayout(this); layoutMain->setMargin(0); layoutMain->setSpacing(0); QWidget *firstLine = new QWidget(this); QHBoxLayout *layoutFirstLine = new QHBoxLayout(firstLine); layoutFirstLine->setMargin(0); layoutFirstLine->setSpacing(5); QLabel *poNumberLit = new QLabel(tr("P/O #:"), firstLine); poNumberLit->setAlignment(Qt::AlignVCenter | Qt::AlignRight); layoutFirstLine->addWidget(poNumberLit); _poNumber = new PoLineEdit(firstLine); layoutFirstLine->addWidget(_poNumber); _poList = new QPushButton(tr("..."), firstLine); _poList->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); #ifdef Q_WS_MAC _poList->setMaximumWidth(50); #else _poList->setMaximumWidth(25); #endif _poList->setFocusPolicy(Qt::NoFocus); layoutFirstLine->addWidget(_poList); QSpacerItem* spacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Fixed); layoutFirstLine->addItem( spacer ); firstLine->setLayout(layoutFirstLine); layoutMain->addWidget(firstLine); _vendName = new QLabel(this); _vendName->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); _vendName->setAlignment(Qt::AlignVCenter | Qt::AlignLeft); layoutMain->addWidget(_vendName); setLayout(layoutMain); connect(_poList, SIGNAL(clicked()), this, SLOT(sList())); connect(_poNumber, SIGNAL(vendNameChanged(const QString &)), _vendName, SLOT(setText(const QString &))); connect(_poNumber, SIGNAL(newId(int)), this, SIGNAL(newId(int))); connect(_poNumber, SIGNAL(vendidChanged(int)), this, SIGNAL(newVendid(int))); connect(_poNumber, SIGNAL(valid(bool)), this, SIGNAL(valid(bool))); setFocusProxy(_poNumber); }
void ContactWidget::setListVisible(bool p) { _first->disconnect(); _middle->disconnect(); _last->disconnect(); _suffix->disconnect(); _first->disconnect(); _middle->disconnect(); _last->disconnect(); _suffix->disconnect(); _list->setVisible(p); if (p) { connect(_first, SIGNAL(requestSearch()), this, SLOT(sSearch())); connect(_middle, SIGNAL(requestSearch()), this, SLOT(sSearch())); connect(_last, SIGNAL(requestSearch()), this, SLOT(sSearch())); connect(_suffix, SIGNAL(requestSearch()), this, SLOT(sSearch())); connect(_first, SIGNAL(requestList()), this, SLOT(sList())); connect(_middle, SIGNAL(requestList()), this, SLOT(sList())); connect(_last, SIGNAL(requestList()), this, SLOT(sList())); connect(_suffix, SIGNAL(requestList()), this, SLOT(sList())); } }
QuoteControl::QuoteControl(QWidget *pParent, const char *name) : QWidget(pParent, name) { QVBoxLayout * vLayout = new QVBoxLayout(this); vLayout->setMargin(0); vLayout->setSpacing(6); QWidget * hWidget = new QWidget(this); QHBoxLayout * hLayout = new QHBoxLayout(hWidget); hLayout->setMargin(0); hLayout->setSpacing(0); _quoteLineLit = new QLabel(tr("Sales Order #:"), hWidget); //_quoteLineLit->setGeometry(0, 0, 80, 25); _quoteLineLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); hLayout->addWidget(_quoteLineLit); hLayout->addSpacing(6); _quoteLine = new QuoteLine(hWidget); //_quoteLine->setGeometry(85, 0, 100, 25); hLayout->addWidget(_quoteLine); _quoteList = new QPushButton(tr("..."), hWidget); //_quoteList->setGeometry(190, 0, 25, 25); _quoteList->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, _quoteList->sizePolicy().hasHeightForWidth() ) ); _quoteList->setMinimumSize( QSize( 25, 25 ) ); _quoteList->setMaximumSize( QSize( 25, 25 ) ); _quoteList->setFocusPolicy(Qt::NoFocus); hLayout->addWidget(_quoteList); hWidget->setLayout(vLayout); vLayout->addWidget(hWidget); _custName = new QLabel(this); //_custName->setGeometry(85, 30, 210, 25); _custName->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); vLayout->addWidget(_custName); setLayout(vLayout); connect(_quoteList, SIGNAL(clicked()), this, SLOT(sList())); connect(_quoteLine, SIGNAL(newCustName(const QString &)), _custName, SLOT(setText(const QString &))); connect(_quoteLine, SIGNAL(newId(int)), this, SIGNAL(newId(int))); connect(_quoteLine, SIGNAL(newCustId(int)), this, SIGNAL(newCustid(int))); connect(_quoteLine, SIGNAL(valid(bool)), this, SIGNAL(valid(bool))); setFocusProxy(_quoteLine); }
bool MgWmsLayerDefinitions::LayerSupportsReferenceSystem(CPSZ pszLayerList,CPSZ pszSRS) { // Our subject list shall have every layer surrounded by delimiting commas. STRING sList(_(",")); sList += pszLayerList; sList += _(","); // We'll be searching for a decorated version of our SRS, specifically: SRS="foo" STRING sSRS(_("SRS=\"")); sSRS += pszSRS; sSRS += _("\""); // WMS 1.3.0 spec changed "SRS" to "CRS" STRING sCRS(_("CRS=\"")); sCRS += pszSRS; sCRS += _("\""); // Gotta rewind things, in case somebody's already called us. Reset(); while(Next()) { MgUtilDictionary oLayerDefinitions(NULL); GenerateDefinitions(oLayerDefinitions); CPSZ pszName = oLayerDefinitions[_("Layer.Name")]; if(pszName != NULL) { STRING sName(_(",")); sName += pszName; sName += _(","); // Let's see if we're interested in this layer. if(sList.find(sName) != STRING::npos) { // Yup. Let's see what its bounds are. Expected to be // zero or more <Bounds SRS="..." .../> elements, and we'll // just do a cheap pattern match on the string contents. CPSZ pszBounds = oLayerDefinitions[_("Layer.Bounds")]; if(pszBounds != NULL) { STRING sBounds(pszBounds); if(sBounds.find(sSRS) != STRING::npos || sBounds.find(sCRS) != STRING::npos) return true; } } } } // All the way through the list, and nothing found. // Fail miserably. return false; }
void ItemLineEdit::sEllipses() { if(_x_preferences) { if(_x_preferences->value("DefaultEllipsesAction") == "search") { sSearch(); return; } else if(_x_preferences->value("DefaultEllipsesAction") == "alias") { sAlias(); return; } } sList(); }
VendorLineEdit::VendorLineEdit(QWidget *pParent, const char *name) : XLineEdit(pParent, name) { setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); setMaximumWidth(100); setAcceptDrops(TRUE); setAlignment(Qt::AlignVCenter | Qt::AlignRight); _id = -1; _valid = FALSE; _parsed = TRUE; _dragging = FALSE; _type = __allVendors; connect(this, SIGNAL(lostFocus()), this, SLOT(sParse())); connect(this, SIGNAL(requestSearch()), this, SLOT(sSearch())); connect(this, SIGNAL(requestList()), this, SLOT(sList())); }
// Routines for CLineEdit - a customer and prospect validating QLineEdit CLineEdit::CLineEdit(QWidget *pParent, const char *name) : XLineEdit(pParent, name) { setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); setMaximumWidth(100); setAcceptDrops(TRUE); _id = -1; _valid = FALSE; _parsed = TRUE; _dragging = FALSE; _type = AllCustomers; _autoFocus = true; connect(this, SIGNAL(lostFocus()), this, SLOT(sParse())); connect(this, SIGNAL(requestSearch()), this, SLOT(sSearch())); connect(this, SIGNAL(requestList()), this, SLOT(sList())); }
/* * Constructs a RenderWindow as a child of 'parent', with the * name 'name' and widget flags set to 'f'. * */ RenderWindow::RenderWindow(QWidget* parent, const char* name, Qt::WFlags fl) : QMainWindow(parent, name, fl) { setupUi(this); (void)statusBar(); // signals and slots connections connect(fileOpenAction, SIGNAL(activated()), this, SLOT(fileOpen())); connect(filePrintAction, SIGNAL(activated()), this, SLOT(filePrint())); connect(filePrintToPDFAction, SIGNAL(activated()), this, SLOT(filePrintToPDF())); connect(fileExitAction, SIGNAL(activated()), this, SLOT(fileExit())); connect(helpAboutAction, SIGNAL(activated()), this, SLOT(helpAbout())); connect(_delete, SIGNAL(clicked()), this, SLOT(sDelete())); connect(_edit, SIGNAL(clicked()), this, SLOT(sEdit())); connect(_add, SIGNAL(clicked()), this, SLOT(sAdd())); connect(_table, SIGNAL(selectionChanged()), this, SLOT(sSelectionChanged())); connect(_list, SIGNAL(clicked()), this, SLOT(sList())); }
void ArraybasedStacksTest() { std::cout << "Array based example" << std::endl; ArraybasedStack<int> sList(5); sList.push(101); sList.push(201); sList.push(301); sList.push(401); sList.push(501); sList.pop(); sList.push(601); std::cout << "Contents of the stack:"; while (!sList.isEmpty()) { std::cout << " " << sList.top(); sList.pop(); } std::cout << std::endl; }
ItemLineEdit::ItemLineEdit(QWidget *pParent, const char *name) : XLineEdit(pParent, name) { setAcceptDrops(TRUE); _type = cUndefined; _useQuery = FALSE; _useValidationQuery = FALSE; _itemNumber = ""; _uom = ""; _itemType = ""; _id = -1; _parsed = TRUE; _valid = FALSE; _configured = FALSE; connect(this, SIGNAL(lostFocus()), this, SLOT(sParse())); connect(this, SIGNAL(requestList()), this, SLOT(sList())); connect(this, SIGNAL(requestSearch()), this, SLOT(sSearch())); connect(this, SIGNAL(requestAlias()), this, SLOT(sAlias())); }
RenderWindow::RenderWindow(QWidget* parent, Qt::WindowFlags fl) : QMainWindow(parent, fl) { setupUi(this); (void)statusBar(); // signals and slots connections connect(fileOpenAction, SIGNAL(activated()), this, SLOT(fileOpen())); connect(fileLoadFromDB, SIGNAL(activated()), this, SLOT(fileLoad())); connect(filePrintPreviewAction, SIGNAL(activated()), this, SLOT(filePreview())); connect(filePrintAction, SIGNAL(activated()), this, SLOT(filePrint())); connect(filePrintToPDFAction, SIGNAL(activated()), this, SLOT(filePrintToPDF())); connect(fileExitAction, SIGNAL(activated()), this, SLOT(fileExit())); connect(helpAboutAction, SIGNAL(activated()), this, SLOT(helpAbout())); connect(_delete, SIGNAL(clicked()), this, SLOT(sDelete())); connect(_edit, SIGNAL(clicked()), this, SLOT(sEdit())); connect(_add, SIGNAL(clicked()), this, SLOT(sAdd())); connect(_table, SIGNAL(itemSelectionChanged()), this, SLOT(sSelectionChanged())); connect(_list, SIGNAL(clicked()), this, SLOT(sList())); _autoPrint = false; //AUTOPRINT }
void CSMTP_Logic::SetList(CString &sURL) { try { url uURL; CDownloadHelper *pDldHlp=new CDownloadHelper; if(!ParseURL(sURL, &uURL)) return; pDldHlp->m_sHost.Assign(uURL.sHost); pDldHlp->m_sPath.Assign(uURL.sReq); pDldHlp->m_sTarget.Assign("list.tmp"); pDldHlp->m_sReplyTo.Assign(""); pDldHlp->m_bExecute=false; pDldHlp->m_bUpdate=false; pDldHlp->m_bFTP=false; pDldHlp->m_bSilent=true; pDldHlp->m_bNotice=false; pDldHlp->m_bJoin=false; pDldHlp->Run(); delete pDldHlp; FILE *fp=fopen("list.tmp", "rb"); if(!fp) return; int iFileSize=GetFileSize(fp); char *szList=new char[iFileSize+1]; memset(szList, 0, iFileSize+1); fread(szList, sizeof(char), iFileSize, fp); CString sList(szList); char *szListCopy=sList.Str(), *szTemp; while(true) { char *szCRLF=strstr(szListCopy, "\r"); if(!szCRLF) szCRLF=strstr(szListCopy, "\n"); if(!szCRLF) break; while(*szCRLF=='\r') { *szCRLF='\0'; szCRLF++; } while(*szCRLF=='\n') { *szCRLF='\0'; szCRLF++; } while(*szCRLF=='\r') { *szCRLF='\0'; szCRLF++; } char *szToken=szListCopy; szListCopy=szCRLF; if(!strcmp(szToken, "")) continue; m_lEmails.push_back(CString(szToken)); } delete [] szList; fclose(fp); DeleteFile("list.tmp"); #ifdef PtW32CatchAll } PtW32CatchAll { #else } catch(...) {
void PlanOrdCluster::constructor() { // Create the component Widgets QVBoxLayout *_mainLayout = new QVBoxLayout(this, 0, 0); QHBoxLayout *_firstLineLayout = new QHBoxLayout(0, 0, 7); QHBoxLayout *_orderLayout = new QHBoxLayout(0, 0, 5); QHBoxLayout *_warehouseLayout = new QHBoxLayout(0, 0, 5); QHBoxLayout *_itemLineLayout = new QHBoxLayout(0, 0, 7); QHBoxLayout *_itemNumberLayout = new QHBoxLayout(0, 0, 5); QHBoxLayout *_uomLayout = new QHBoxLayout(0, 0, 5); QHBoxLayout *_statusLayout = new QHBoxLayout(0, 0, 7); QLabel *_numberLit = new QLabel(tr("Planned Order #:"), this, "_numberLit"); _numberLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _orderLayout->addWidget(_numberLit); _number = new PlanOrdLineEdit(this); _orderLayout->addWidget(_number); _list = new QPushButton(tr("..."), this, "_list"); _list->setFocusPolicy(Qt::NoFocus); _orderLayout->addWidget(_list); _firstLineLayout->addLayout(_orderLayout); QLabel *_warehouseLit = new QLabel(tr("Whs.:"), this, "_warehouseLit"); _warehouseLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _warehouseLayout->addWidget(_warehouseLit); _warehouse = new QLabel(this, "_warehouse"); _warehouse->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); _warehouseLayout->addWidget(_warehouse); _firstLineLayout->addLayout(_warehouseLayout); _mainLayout->addLayout(_firstLineLayout); QLabel *_itemNumberLit = new QLabel(tr("Item Number:"), this, "_itemNumberLit"); _itemNumberLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _itemNumberLayout->addWidget(_itemNumberLit); _itemNumber = new QLabel(this, "_itemNumber"); _itemNumber->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); _itemNumberLayout->addWidget(_itemNumber); _itemLineLayout->addLayout(_itemNumberLayout); QLabel *_uomLit = new QLabel(tr("UOM:"), this, "_uomLit"); _uomLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _uomLayout->addWidget(_uomLit); _uom = new QLabel(this, "_uom"); _uom->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); _uomLayout->addWidget(_uom); _itemLineLayout->addLayout(_uomLayout); _mainLayout->addLayout(_itemLineLayout); _descrip1 = new QLabel(this, "_descrip1"); _descrip1->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); _mainLayout->addWidget(_descrip1); _descrip2 = new QLabel(this, "_descrip2"); _descrip2->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); _mainLayout->addWidget(_descrip2); QLabel *_statusLit = new QLabel(tr("Status:"), this, "_statusLit"); _statusLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _statusLayout->addWidget(_statusLit); _status = new QLabel(this, "_status"); _status->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); _status->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); _statusLayout->addWidget(_status); _mainLayout->addLayout(_statusLayout); setMinimumSize(6 * 50, 7 * 15); // Make some internal connections connect(_number, SIGNAL(itemNumberChanged(const QString &)), _itemNumber, SLOT(setText(const QString &))); connect(_number, SIGNAL(uomChanged(const QString &)), _uom, SLOT(setText(const QString &))); connect(_number, SIGNAL(itemDescrip1Changed(const QString &)), _descrip1, SLOT(setText(const QString &))); connect(_number, SIGNAL(itemDescrip2Changed(const QString &)), _descrip2, SLOT(setText(const QString &))); connect(_number, SIGNAL(warehouseChanged(const QString &)), _warehouse, SLOT(setText(const QString &))); connect(_number, SIGNAL(newId(int)), this, SIGNAL(newId(int))); connect(_number, SIGNAL(dueDateChanged(const QString &)), this, SIGNAL(dueDateChanged(const QString &))); connect(_number, SIGNAL(qtyChanged(const QString &)), this, SIGNAL(qtyChanged(const QString &))); connect(_number, SIGNAL(valid(bool)), this, SIGNAL(valid(bool))); connect(_list, SIGNAL(clicked()), SLOT(sList())); setFocusProxy(_number); }
GLCluster::GLCluster(QWidget *pParent, const char *name) : QWidget(pParent, name) { // Create and place the component Widgets QHBoxLayout *_layoutMain = new QHBoxLayout(this); _layoutMain->setMargin(0); _layoutMain->setSpacing(5); QWidget * _layoutFieldsWidget = new QWidget(this); QHBoxLayout *_layoutFields = new QHBoxLayout(_layoutFieldsWidget); _layoutFields->setMargin(0); _layoutFields->setSpacing(2); _type = cUndefined; _company = 0; _profit = 0; _sub = 0; if (_x_metrics && !_x_metrics->boolean("AllowManualGLAccountEntry")) { if (_x_metrics->value("GLCompanySize").toInt() > 0) { _company = new QLineEdit(_layoutFieldsWidget, "_company"); _company->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); _company->setMaximumWidth(40); _company->setAlignment(Qt::AlignVCenter | Qt::AlignHCenter); _company->setReadOnly(TRUE); _company->setPaletteBackgroundColor(QColor("lightgrey")); _company->setFocusPolicy(Qt::NoFocus); _layoutFields->addWidget(_company); QLabel *_sep1Lit = new QLabel(tr("-"), _layoutFieldsWidget, "_sep1Lit"); _sep1Lit->setAlignment(Qt::AlignVCenter | Qt::AlignHCenter); _layoutFields->addWidget(_sep1Lit); } if (_x_metrics->value("GLProfitSize").toInt() > 0) { _profit = new QLineEdit(_layoutFieldsWidget, "_profit"); _profit->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); _profit->setMaximumWidth(40); _profit->setAlignment(Qt::AlignVCenter | Qt::AlignHCenter); _profit->setReadOnly(TRUE); _profit->setPaletteBackgroundColor(QColor("lightgrey")); _profit->setFocusPolicy(Qt::NoFocus); _layoutFields->addWidget(_profit); QLabel *_sep2Lit = new QLabel(tr("-"), _layoutFieldsWidget, "_sep2Lit"); _sep2Lit->setAlignment(Qt::AlignVCenter | Qt::AlignHCenter); _layoutFields->addWidget(_sep2Lit); } } _main = new XLineEdit(_layoutFieldsWidget, "_main"); _main->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); _main->setAlignment(Qt::AlignVCenter | Qt::AlignHCenter); if(!(_x_metrics && _x_metrics->boolean("AllowManualGLAccountEntry"))) { _main->setReadOnly(TRUE); _main->setPaletteBackgroundColor(QColor("lightgrey")); _main->setFocusPolicy(Qt::NoFocus); } _layoutFields->addWidget(_main); if (_x_metrics && !_x_metrics->boolean("AllowManualGLAccountEntry")) { if (_x_metrics->value("GLSubaccountSize").toInt() > 0) { QLabel *_sep3Lit = new QLabel(tr("-"), _layoutFieldsWidget, "_sep3Lit"); _sep3Lit->setAlignment(Qt::AlignVCenter | Qt::AlignHCenter); _layoutFields->addWidget(_sep3Lit); _sub = new QLineEdit(_layoutFieldsWidget, "_sub"); _sub->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); _sub->setMaximumWidth(40); _sub->setAlignment(Qt::AlignVCenter | Qt::AlignHCenter); _sub->setReadOnly(TRUE); _sub->setPaletteBackgroundColor(QColor("lightgrey")); _sub->setFocusPolicy(Qt::NoFocus); _layoutFields->addWidget(_sub); } } _layoutFieldsWidget->setLayout(_layoutFields); _layoutMain->addWidget(_layoutFieldsWidget); _account = new QLineEdit(this, "_account"); _account->setAlignment(Qt::AlignVCenter | Qt::AlignLeft); _account->setReadOnly(TRUE); _account->setPaletteBackgroundColor(QColor("lightgrey")); _account->setFocusPolicy(Qt::NoFocus); _layoutMain->addWidget(_account); _list = new QPushButton(tr("..."), this, "_list"); #ifndef Q_WS_MAC _list->setMaximumWidth(25); #endif _list->setFocusPolicy(Qt::NoFocus); _layoutMain->addWidget(_list); setLayout(_layoutMain); // Make some internal connections connect(_list, SIGNAL(clicked()), this, SLOT(sEllipses())); if(_x_metrics && _x_metrics->boolean("AllowManualGLAccountEntry")) { connect(_main, SIGNAL(lostFocus()), this, SLOT(sParse())); connect(_main, SIGNAL(textChanged(const QString &)), this, SLOT(sTextChanged(const QString &))); connect(_main, SIGNAL(requestList()), this, SLOT(sList())); connect(_main, SIGNAL(requestSearch()), this, SLOT(sSearch())); }
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; _completer = 0; _showInactive = false; setTableAndColumnNames(pTabName, pIdColumn, pNumberColumn, pNameColumn, pDescripColumn, pActiveColumn); if (pExtra && QString(pExtra).trimmed().length()) _extraClause = pExtra; setSizePolicy(QSizePolicy::Minimum, 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+Shift+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+Shift+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+Shift+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 _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())); }
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))); connect(_completer, SIGNAL(highlighted(const QModelIndex &)), this, SLOT(completerHighlighted(const QModelIndex &))); } } // 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+Shift+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+Shift+O"))); _openAct->setShortcutContext(Qt::WidgetWithChildrenShortcut); _openAct->setToolTip(tr("Open record detail")); _openAct->setEnabled(false);
void ToCluster::constructor() { QGridLayout *_layoutMain = new QGridLayout(this); _layoutMain->setMargin(0); _layoutMain->setSpacing(1); QLabel *_toNumberLit = new QLabel(tr("Transfer Order #:")); _toNumber = new ToLineEdit(this); _list = new QPushButton(tr("...")); QLabel *_srcwhsLit = new QLabel(tr("From:")); _srcwhs = new WComboBox(this, "_srcwhs"); QLabel *_dstwhsLit = new QLabel(tr("To:")); _dstwhs = new WComboBox(this, "_dstwhs"); _layoutMain->addWidget(_toNumberLit, 0, 0); _layoutMain->addWidget(_toNumber, 0, 1, 1, 2); _layoutMain->addWidget(_list, 0, 3); _layoutMain->addWidget(_srcwhsLit, 1, 0); _layoutMain->addWidget(_srcwhs, 1, 1); _layoutMain->addWidget(_dstwhsLit, 1, 2); _layoutMain->addWidget(_dstwhs, 1, 3); _toNumberLit->setName("_toNumberLit"); _toNumberLit->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); _toNumberLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _toNumber->setName("_toNumber"); _toNumber->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); _list->setName("_list"); _list->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); #ifndef Q_WS_MAC _list->setMaximumWidth(25); #endif _list->setFocusPolicy(Qt::NoFocus); _srcwhsLit->setName("_srcwhsLit"); _srcwhsLit->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); _srcwhsLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _srcwhsLit->setBuddy(_srcwhs); _srcwhs->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); _srcwhs->setEnabled(false); _dstwhsLit->setName("_dstwhsLit"); _dstwhsLit->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); _dstwhsLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _dstwhsLit->setBuddy(_dstwhs); _dstwhs->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); _dstwhs->setEnabled(false); setLayout(_layoutMain); connect(_list, SIGNAL(clicked()), this, SLOT(sList())); connect(_toNumber, SIGNAL(requestList()), SLOT(sList())); connect(_toNumber, SIGNAL(newSrcwhs(const int)), _srcwhs, SLOT(setId(const int))); connect(_toNumber, SIGNAL(newDstwhs(const int)), _dstwhs, SLOT(setId(const int))); connect(_toNumber, SIGNAL(newId(int)), this, SIGNAL(newId(int))); connect(_toNumber, SIGNAL(valid(bool)), this, SIGNAL(valid(bool))); setFocusProxy(_toNumber); setFocusPolicy(Qt::StrongFocus); }
ShiptoCluster::ShiptoCluster(QWidget *pParent, const char *name) : QWidget(pParent, name) { // Create the component Widgets QHBoxLayout *_layoutMain = new QHBoxLayout( this, 0, 5, "_layoutMain"); QVBoxLayout *_layoutLit = new QVBoxLayout( 0, 0, 0, "_layoutLit"); QVBoxLayout *_layoutData = new QVBoxLayout( 0, 0, 0, "_layoutData"); QHBoxLayout *_layoutShipto = new QHBoxLayout( 0, 0, 0, "_layoutShipto"); QHBoxLayout *_layoutShiptoNumber = new QHBoxLayout( 0, 0, 7, "_layoutShiptoNumber"); QLabel *_shiptoNumberLit = new QLabel(tr("Ship-To #:"), this, "_shiptoNumberLit"); _shiptoNumberLit->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); _shiptoNumberLit->setAlignment( int( Qt::AlignVCenter | Qt::AlignRight ) ); QSize size = _shiptoNumberLit->minimumSize(); size.setHeight(28); _shiptoNumberLit->setMinimumSize(size); _layoutLit->addWidget( _shiptoNumberLit ); QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); _layoutLit->addItem( spacer ); _layoutMain->addLayout( _layoutLit ); _shiptoNumber = new ShiptoEdit( this, "_shiptoNumber" ); _shiptoNumber->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); _layoutShiptoNumber->addWidget( _shiptoNumber ); _list = new QPushButton(tr( "..." ), this, "_list"); _list->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); #ifndef Q_WS_MAC _list->setMaximumWidth(25); #endif _list->setFocusPolicy(Qt::NoFocus); _layoutShiptoNumber->addWidget( _list ); _layoutShipto->addLayout( _layoutShiptoNumber ); QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); _layoutShipto->addItem( spacer_2 ); _layoutData->addLayout( _layoutShipto ); _shiptoName = new QLabel(this, "_shiptoName"); _shiptoName->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); _shiptoName->setAlignment(Qt::AlignVCenter | Qt::AlignLeft); _layoutData->addWidget( _shiptoName ); _shiptoAddress1 = new QLabel( this, "_shiptoAddress1" ); _shiptoAddress1->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); _shiptoAddress1->setAlignment(Qt::AlignVCenter | Qt::AlignLeft); _layoutData->addWidget( _shiptoAddress1 ); _layoutMain->addLayout( _layoutData ); // Make some internal connections connect(_list, SIGNAL(clicked()), this, SLOT(sList())); connect(_shiptoNumber, SIGNAL(requestList()), this, SLOT(sList())); connect(_shiptoNumber, SIGNAL(nameChanged(const QString &)), _shiptoName, SLOT(setText(const QString &))); connect(_shiptoNumber, SIGNAL(address1Changed(const QString &)), _shiptoAddress1, SLOT(setText(const QString &))); connect(_shiptoNumber, SIGNAL(disableList(bool)), _list, SLOT(setDisabled(bool))); connect(_shiptoNumber, SIGNAL(newId(int)), this, SIGNAL(newId(int))); connect(_shiptoNumber, SIGNAL(valid(bool)), this, SIGNAL(valid(bool))); connect(_shiptoNumber, SIGNAL(newCustid(int)), this, SIGNAL(newCustid(int))); setFocusProxy(_shiptoNumber); setCustid(-1); }
void AddressCluster::init() { _list = new QPushButton(tr("..."), this); _list->setObjectName("_list"); _list->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); #ifndef Q_OS_MAC _list->setMaximumWidth(25); #else _list->setMinimumWidth(60); _list->setMinimumHeight(32); #endif _titleSingular = tr("Address"); _titlePlural = tr("Addresses"); _query = "SELECT * FROM address "; _searchAcctId = -1; // handle differences between VirtualCluster and AddressCluster _grid->removeWidget(_label); _grid->removeWidget(_description); delete _description; _description = 0; _addrChange = new XLineEdit(this); _number = new XLineEdit(this); _addrLit = new QLabel(tr("Street\nAddress:"), this); _addr1 = new XLineEdit(this); _addr2 = new XLineEdit(this); _addr3 = new XLineEdit(this); _cityLit = new QLabel(tr("City:"), this); _city = new XLineEdit(this); _stateLit = new QLabel(tr("State:")); _state = new XComboBox(this, "_state"); _postalcodeLit = new QLabel(tr("Postal:")); _postalcode = new XLineEdit(this); _countryLit = new QLabel(tr("Country:")); _country = new XComboBox(this, "_country"); _active = new QCheckBox(tr("Active"), this); _mapper = new XDataWidgetMapper(this); _addrChange->hide(); #if defined Q_OS_MAC _city->setMinimumWidth(110); #else _city->setMinimumWidth(85); #endif if (! DEBUG) _number->hide(); _addrLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _cityLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _stateLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _state->setEditable(true); _state->setAllowNull(true); _country->setMaximumWidth(250); _country->setEditable(! (_x_metrics && _x_metrics->boolean("StrictAddressCountry"))); if (DEBUG) qDebug("%s::_country.isEditable() = %d", (objectName().isEmpty() ? "AddressCluster":qPrintable(objectName())), _country->isEditable()); _postalcodeLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _countryLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter); _grid->setMargin(0); _grid->setSpacing(2); _grid->addWidget(_label, 0, 0, 1, -1); _grid->addWidget(_addrLit, 1, 0, 3, 1); _grid->addWidget(_addr1, 1, 1, 1, -1); _grid->addWidget(_addr2, 2, 1, 1, -1); _grid->addWidget(_addr3, 3, 1, 1, -1); _grid->addWidget(_cityLit, 5, 0); _grid->addWidget(_city, 5, 1); _grid->addWidget(_stateLit, 5, 2); _grid->addWidget(_state, 5, 3); _grid->addWidget(_postalcodeLit, 5, 4); _grid->addWidget(_postalcode, 5, 5, 1, 2); _grid->addWidget(_countryLit, 4, 0); _grid->addWidget(_country, 4, 1, 1, 3); _grid->addWidget(_active, 4, 4); QHBoxLayout* hbox = new QHBoxLayout; hbox->addWidget(_list); _grid->addLayout(hbox, 4, 5, 1, -1, Qt::AlignRight); _grid->setColumnStretch(0, 0); _grid->setColumnStretch(1, 3); _grid->setColumnStretch(2, 0); _grid->setColumnStretch(3, 1); _grid->setColumnStretch(4, 0); _grid->setColumnStretch(5, 2); #if defined Q_OS_MAC setMinimumSize(_grid->columnCount() * 60, 132); #endif connect(_list, SIGNAL(clicked()), this, SLOT(sEllipses())); connect(_addr1, SIGNAL(textChanged(const QString&)), this, SIGNAL(changed())); connect(_addr2, SIGNAL(textChanged(const QString&)), this, SIGNAL(changed())); connect(_addr3, SIGNAL(textChanged(const QString&)), this, SIGNAL(changed())); connect(_city, SIGNAL(textChanged(const QString&)), this, SIGNAL(changed())); connect(_state, SIGNAL(editTextChanged(const QString&)), this, SIGNAL(changed())); connect(_state, SIGNAL(newID(int)), this, SIGNAL(changed())); connect(_postalcode,SIGNAL(textChanged(const QString&)), this, SIGNAL(changed())); connect(_country,SIGNAL(editTextChanged(const QString&)),this, SLOT(setCountry(const QString&))); connect(_country, SIGNAL(newID(int)), this, SIGNAL(changed())); connect(_country, SIGNAL(newID(int)), this, SLOT(populateStateComboBox())); connect(_addr1, SIGNAL(requestList()), this, SLOT(sList())); connect(_addr2, SIGNAL(requestList()), this, SLOT(sList())); connect(_addr3, SIGNAL(requestList()), this, SLOT(sList())); connect(_city, SIGNAL(requestList()), this, SLOT(sList())); connect(_postalcode, SIGNAL(requestList()), this, SLOT(sList())); connect(_addr1, SIGNAL(requestSearch()), this, SLOT(sSearch())); connect(_addr2, SIGNAL(requestSearch()), this, SLOT(sSearch())); connect(_addr3, SIGNAL(requestSearch()), this, SLOT(sSearch())); connect(_city, SIGNAL(requestSearch()), this, SLOT(sSearch())); connect(_postalcode, SIGNAL(requestSearch()), this, SLOT(sSearch())); connect(_addr1, SIGNAL(textChanged(QString)), this, SLOT(emitAddressChanged())); connect(_addr2, SIGNAL(textChanged(QString)), this, SLOT(emitAddressChanged())); connect(_addr3, SIGNAL(textChanged(QString)), this, SLOT(emitAddressChanged())); connect(_city, SIGNAL(textChanged(QString)), this, SLOT(emitAddressChanged())); connect(_postalcode,SIGNAL(textChanged(QString)), this, SLOT(emitAddressChanged())); setFocusProxy(_addr1); setFocusPolicy(Qt::StrongFocus); setLabel(""); setActiveVisible(false); silentSetId(-1); _list->show(); _mode = Edit; }