#include <projecteditor.h>
Public Member Functions | |
LocationEditor (QWidget *parent=0) |
Editor for locations.
LocationEditor::LocationEditor | ( | QWidget * | parent = 0 |
) | [inline] |
: MappedBaseEditor(parent) { setObjectName("LocationEditor"); setWindowTitle("Location editor"); //set source setTable("tbl_locations", "loca_country", Qt::AscendingOrder); // widget setup QLabel *country = new QLabel("&Country*:", this); QLabel *region = new QLabel("&City*:", this); QLabel *postalCode = new QLabel("&Postal code:", this); QLabel *address = new QLabel("&Address:", this); QLabel *phone = new QLabel("Phone &number:", this); QLabel *desc = new QLabel("Decription:", this); QLineEdit *countryEdit = new QLineEdit(this); QLineEdit *regionEdit = new QLineEdit(this); QLineEdit *postalCodeEdit = new QLineEdit(this); QTextEdit *addressEdit = new QTextEdit(this); QLineEdit *phoneEdit = new QLineEdit(this); QTextEdit *descEdit = new QTextEdit(this); country->setBuddy(countryEdit); region->setBuddy(regionEdit); postalCode->setBuddy(postalCodeEdit); address->setBuddy(addressEdit); phone->setBuddy(phoneEdit); desc->setBuddy(descEdit); QSizePolicy policy(addressEdit->sizePolicy()); policy.setVerticalStretch(1); addressEdit->setSizePolicy(policy); policy.setVerticalStretch(2); descEdit->setSizePolicy(policy); // add widgets addWidget(country, 0, 0, 1, 1); addWidget(countryEdit, 0, 1, 1, 1, "loca_country"); addWidget(region, 1, 0, 1, 1); addWidget(regionEdit, 1, 1, 1, 1, "loca_region"); addWidget(postalCode, 2, 0, 1, 1); addWidget(postalCodeEdit, 2, 1, 1, 1, "loca_postalcode"); addWidget(address, 3, 0, 1, 1); addWidget(addressEdit, 3, 1, 1, 1, "loca_address", "plainText"); addWidget(phone, 4, 0, 1, 1); addWidget(phoneEdit, 4, 1, 1, 1, "loca_phone"); addWidget(desc, 5, 0, 1, 1); addWidget(descEdit, 5, 1, 1, 1, "loca_desc", "plainText"); // setup connections connect(countryEdit, SIGNAL(textChanged(QString)), this, SLOT(updateButtons())); connect(regionEdit, SIGNAL(textChanged(QString)), this, SLOT(updateButtons())); connect(postalCodeEdit, SIGNAL(textChanged(QString)), this, SLOT(updateButtons())); connect(addressEdit, SIGNAL(textChanged()), this, SLOT(updateButtons())); connect(phoneEdit, SIGNAL(textChanged(QString)), this, SLOT(updateButtons())); connect(descEdit, SIGNAL(textChanged()), this, SLOT(updateButtons())); // update changes select(); }