QScriptDebuggerCodeFinderWidget::QScriptDebuggerCodeFinderWidget(QWidget *parent)
    : QScriptDebuggerCodeFinderWidgetInterface(
        *new QScriptDebuggerCodeFinderWidgetPrivate, parent, 0)
{
    Q_D(QScriptDebuggerCodeFinderWidget);
    QString system = QLatin1String("win");
    QHBoxLayout *hboxLayout = new QHBoxLayout(this);
#ifdef Q_OS_MAC
    system = QLatin1String("mac");
#else
    hboxLayout->setSpacing(6);
    hboxLayout->setMargin(0);
#endif

    d->toolClose = new QToolButton(this);
    d->toolClose->setIcon(QIcon(QString::fromUtf8(":/qt/scripttools/debugging/images/%1/closetab.png").arg(system)));
    d->toolClose->setAutoRaise(true);
    d->toolClose->setText(tr("Close"));
    hboxLayout->addWidget(d->toolClose);

    d->editFind = new QLineEdit(this);
    d->editFind->setMinimumSize(QSize(150, 0));
    connect(d->editFind, SIGNAL(textChanged(QString)),
            this, SLOT(_q_updateButtons()));
    connect(d->editFind, SIGNAL(returnPressed()),
            this, SLOT(_q_next()));
    hboxLayout->addWidget(d->editFind);

    d->toolPrevious = new QToolButton(this);
    d->toolPrevious->setAutoRaise(true);
    d->toolPrevious->setText(tr("Previous"));
    d->toolPrevious->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    d->toolPrevious->setIcon(QIcon(QString::fromUtf8(":/qt/scripttools/debugging/images/%1/previous.png").arg(system)));
    hboxLayout->addWidget(d->toolPrevious);

    d->toolNext = new QToolButton(this);
    d->toolNext->setAutoRaise(true);
    d->toolNext->setText(tr("Next"));
    d->toolNext->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    d->toolNext->setIcon(QIcon(QString::fromUtf8(":/qt/scripttools/debugging/images/%1/next.png").arg(system)));
    hboxLayout->addWidget(d->toolNext);

    d->checkCase = new QCheckBox(tr("Case Sensitive"), this);
    hboxLayout->addWidget(d->checkCase);

    d->checkWholeWords = new QCheckBox(tr("Whole words"), this);
    hboxLayout->addWidget(d->checkWholeWords);

    d->labelWrapped = new QLabel(this);
    d->labelWrapped->setMinimumSize(QSize(0, 20));
    d->labelWrapped->setMaximumSize(QSize(115, 20));
    d->labelWrapped->setTextFormat(Qt::RichText);
    d->labelWrapped->setScaledContents(true);
    d->labelWrapped->setAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter);
    d->labelWrapped->setText(tr("<img src=\":/qt/scripttools/debugging/images/wrap.png\">&nbsp;Search wrapped"));
    hboxLayout->addWidget(d->labelWrapped);

    QSpacerItem *spacerItem = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
    hboxLayout->addItem(spacerItem);
    setMinimumWidth(minimumSizeHint().width());
    d->labelWrapped->hide();

    d->_q_updateButtons();

    setFocusProxy(d->editFind);
    QObject::connect(d->toolClose, SIGNAL(clicked()), this, SLOT(hide()));
    QObject::connect(d->editFind, SIGNAL(textChanged(QString)),
                     this, SLOT(_q_onTextChanged(QString)));
    QObject::connect(d->toolNext, SIGNAL(clicked()), this, SLOT(_q_next()));
    QObject::connect(d->toolPrevious, SIGNAL(clicked()), this, SLOT(_q_previous()));
}
Exemplo n.º 2
0
Comments::Comments(QWidget *pParent, const char *name) :
  QWidget(pParent)
{
  setObjectName(name);
  _sourceid = -1;
  _editable = true;
  if (_strMap.isEmpty()) {
    (void)commentMap();
  }

  _verboseCommentList = false;

  QVBoxLayout *vbox = new QVBoxLayout(this);

  QHBoxLayout *hbox = new QHBoxLayout();
  hbox->setMargin(0);
  hbox->setSpacing(7);
  
  _verbose = new XCheckBox(tr("Verbose Text"), this);
  _verbose->setObjectName("_verbose");
  _verboseCommentList = _verbose->isChecked();
  vbox->addWidget(_verbose);
      
  vbox->addLayout(hbox);

  QWidget *buttons = new QWidget(this);
  QVBoxLayout * buttonsLayout = new QVBoxLayout(buttons);
  buttonsLayout->setMargin(0);
  buttonsLayout->setSpacing(0);

  _comment = new XTreeWidget(this);
  _comment->setObjectName("_comment");
  _comment->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
  _comment->addColumn(tr("Date/Time"), _timeDateColumn, Qt::AlignCenter,true, "comment_date");
  _comment->addColumn(tr("Type"),    _itemColumn, Qt::AlignCenter,true, "type");
  _comment->addColumn(tr("Source"),  _itemColumn, Qt::AlignCenter,true, "comment_source");
  _comment->addColumn(tr("User Account"),    _userColumn, Qt::AlignCenter,true, "comment_user");
  _comment->addColumn(tr("Comment"), -1,          Qt::AlignLeft,  true, "first");
  _comment->addColumn(tr("Public"),    _ynColumn, Qt::AlignLeft, false, "comment_public");
  hbox->addWidget(_comment);

  _browser = new QTextBrowser(this);
  _browser->setObjectName("_browser");
  _browser->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
  _browser->setOpenLinks(false);
  hbox->addWidget(_browser);

  _newComment = new QPushButton(tr("New"), buttons);
  _newComment->setObjectName("_newComment");
  buttonsLayout->addWidget(_newComment);

  _viewComment = new QPushButton(tr("View"), buttons);
  _viewComment->setObjectName("_viewComment");
  _viewComment->setEnabled(false);
  buttonsLayout->addWidget(_viewComment);

  _editComment = new QPushButton(tr("Edit"), buttons);
  _editComment->setObjectName("_editComment");
  _editComment->setEnabled(false);
  buttonsLayout->addWidget(_editComment);

  QSpacerItem *_buttonSpacer = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
  buttonsLayout->addItem(_buttonSpacer);
  buttons->setLayout(buttonsLayout);
  hbox->addWidget(buttons);
  
  _editmap = new QMultiMap<int, bool>();
  _editmap2 = new QMultiMap<int, bool>();

  connect(_newComment, SIGNAL(clicked()), this, SLOT( sNew()));
  connect(_viewComment, SIGNAL(clicked()), this, SLOT( sView()));
  connect(_editComment, SIGNAL(clicked()), this, SLOT(sEdit()));
  connect(_comment, SIGNAL(valid(bool)), this, SLOT(sCheckButtonPriv(bool)));
  connect(_comment, SIGNAL(itemSelected(int)), _viewComment, SLOT(animateClick()));
  connect(_browser, SIGNAL(anchorClicked(QUrl)), this, SLOT(anchorClicked(QUrl)));
  connect(_verbose, SIGNAL(toggled(bool)), this, SLOT(setVerboseCommentList(bool)));

  setFocusProxy(_comment);
  setVerboseCommentList(_verboseCommentList);
}
Exemplo n.º 3
0
void SingleWindow::init()
{
	setWindowRole("kadu-single-window");

	KaduWindow *kadu = m_kaduWindowService->kaduWindow();
	bool visible = kadu->isVisible();

	m_split = new QSplitter(Qt::Horizontal, this);

	m_tabs = new QTabWidget(this);
	m_tabs->setTabsClosable(true);

	m_rosterPos = m_configuration->deprecatedApi()->readNumEntry("SingleWindow", "RosterPosition", 0);
	if (m_rosterPos == 0)
	{
		m_split->addWidget(kadu);
		m_split->addWidget(m_tabs);
	}
	else
	{
		m_split->addWidget(m_tabs);
		m_split->addWidget(kadu);
	}

	kadu->setMaximumWidth(QWIDGETSIZE_MAX);
	m_tabs->setMaximumWidth(QWIDGETSIZE_MAX);
	kadu->setMinimumWidth(170);
	m_tabs->setMinimumWidth(200);

	new WindowGeometryManager(new ConfigFileVariantWrapper(m_configuration, "SingleWindow", "WindowGeometry"), QRect(0, 0, 800, 440), this);

	int kaduwidth = m_configuration->deprecatedApi()->readNumEntry("SingleWindow", "KaduWindowWidth", 205);

	if (m_rosterPos == 0)
	{
		m_splitSizes.append(kaduwidth);
		m_splitSizes.append(width() - kaduwidth);
	}
	else
	{
		m_splitSizes.append(width() - kaduwidth);
		m_splitSizes.append(kaduwidth);
	}
	m_split->setSizes(m_splitSizes);

	m_title = new ChatWidgetSetTitle{this};
	connect(m_title, SIGNAL(titleChanged()), this, SLOT(titleChanged()));

	m_title->setDefaultTile(kadu->windowTitle());
	m_title->setDefaultIcon(kadu->windowIcon());

	connect(m_tabs, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)));
	connect(m_tabs, SIGNAL(currentChanged(int)), this, SLOT(onTabChange(int)));

	connect(kadu, SIGNAL(keyPressed(QKeyEvent *)), this, SLOT(onkaduKeyPressed(QKeyEvent *)));

	setFocusProxy(kadu);
	kadu->show();
	kadu->setFocus();

	setVisible(visible);
	m_mainWindowRepository->addMainWindow(this);
}
Exemplo n.º 4
0
void WoCluster::constructor()
{
//  Create the component Widgets
  Q3VBoxLayout *_mainLayout      = new Q3VBoxLayout(this, 0, 2, "_layoutMain"); 
  Q3HBoxLayout *_woLayout        = new Q3HBoxLayout(0, 0, 5, "_layoutLit"); 
  Q3HBoxLayout *_warehouseLayout = new Q3HBoxLayout(0, 0, 5, "_layoutLit"); 
  Q3HBoxLayout *_line1Layout     = new Q3HBoxLayout(0, 0, 7, "_layoutLit"); 
  Q3HBoxLayout *_itemLayout      = new Q3HBoxLayout(0, 0, 5, "_layoutLit"); 
  Q3HBoxLayout *_uomLayout       = new Q3HBoxLayout(0, 0, 5, "_layoutLit"); 
  Q3HBoxLayout *_line2Layout     = new Q3HBoxLayout(0, 0, 7, "_layoutLit"); 
  Q3HBoxLayout *_statusLayout    = new Q3HBoxLayout(0, 0, 5, "_layoutLit"); 

  QLabel *woNumberLit = new QLabel(tr("Work Order #:"), this, "woNumberLit");
  woNumberLit->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
  woNumberLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
  _woLayout->addWidget(woNumberLit);

  _woNumber = new WoLineEdit(this);
  _woNumber->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
  _woLayout->addWidget(_woNumber);

  _woList = new QPushButton(tr("..."), this, "_woList");
  _woList->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
#ifndef Q_WS_MAC
  _woList->setMaximumWidth(25);
#endif
  _woList->setFocusPolicy(Qt::NoFocus);
  _woLayout->addWidget(_woList);
  _line1Layout->addLayout(_woLayout);

  QLabel *warehouseLit = new QLabel(tr("Whs.:"), this, "warehouseLit");
  _woNumber->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
  warehouseLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
  _warehouseLayout->addWidget(warehouseLit);

  _warehouse = new QLabel(this, "_warehouse");
  _warehouse->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
  _warehouse->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
  _warehouseLayout->addWidget(_warehouse);
  _line1Layout->addLayout(_warehouseLayout);
  _mainLayout->addLayout(_line1Layout);

  QLabel *itemNumberLit = new QLabel(tr("Item Number:"), this, "itemNumberLit");
  itemNumberLit->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
  itemNumberLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
  _itemLayout->addWidget(itemNumberLit);

  _itemNumber = new QLabel(this, "_itemNumber");
  _itemNumber->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
  _itemNumber->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
  _itemLayout->addWidget(_itemNumber);
  _line2Layout->addLayout(_itemLayout);

  QLabel *uomLit = new QLabel(tr("UOM:"), this, "uomLit");
  uomLit->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
  uomLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
  _uomLayout->addWidget(uomLit);

  _uom = new QLabel(this, "_uom");
  _uom->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
  _uom->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
  _uomLayout->addWidget(_uom);
  _line2Layout->addLayout(_uomLayout);
  _mainLayout->addLayout(_line2Layout);

  _descrip1 = new QLabel(this, "_descrip1");
  _descrip1->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
  _descrip1->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
  _mainLayout->addWidget(_descrip1);

  _descrip2 = new QLabel(this, "_descrip2");
  _descrip2->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
  _descrip2->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
  _mainLayout->addWidget(_descrip2);

  QLabel *statusLit = new QLabel(tr("Status:"), this, "statusLit");
  statusLit->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
  statusLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
  _statusLayout->addWidget(statusLit);

  _status = new QLabel(this, "_status");
  _status->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
  _status->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
  _statusLayout->addWidget(_status);
  _mainLayout->addLayout(_statusLayout);

//  Make some internal connections
  connect(_woNumber, SIGNAL(itemNumberChanged(const QString &)), _itemNumber, SLOT(setText(const QString &)));
  connect(_woNumber, SIGNAL(uomChanged(const QString &)), _uom, SLOT(setText(const QString &)));
  connect(_woNumber, SIGNAL(itemDescrip1Changed(const QString &)), _descrip1, SLOT(setText(const QString &)));
  connect(_woNumber, SIGNAL(itemDescrip2Changed(const QString &)), _descrip2, SLOT(setText(const QString &)));
  connect(_woNumber, SIGNAL(warehouseChanged(const QString &)), _warehouse, SLOT(setText(const QString &)));
  connect(_woNumber, SIGNAL(statusChanged(const QString &)), _status, SLOT(setText(const QString &)));

  connect(_woNumber, SIGNAL(newId(int)), this, SIGNAL(newId(int)));
  connect(_woNumber, SIGNAL(newItemid(int)), this, SIGNAL(newItemid(int)));
  connect(_woNumber, SIGNAL(startDateChanged(const QString &)), this, SIGNAL(startDateChanged(const QString &)));
  connect(_woNumber, SIGNAL(dueDateChanged(const QString &)), this, SIGNAL(dueDateChanged(const QString &)));
  connect(_woNumber, SIGNAL(qtyOrderedChanged(const QString &)), this, SIGNAL(qtyOrderedChanged(const QString &)));
  connect(_woNumber, SIGNAL(qtyReceivedChanged(const QString &)), this, SIGNAL(qtyReceivedChanged(const QString &)));
  connect(_woNumber, SIGNAL(qtyBalanceChanged(const QString &)), this, SIGNAL(qtyBalanceChanged(const QString &)));
  connect(_woNumber, SIGNAL(valid(bool)), this, SIGNAL(valid(bool)));

  connect(_woList, SIGNAL(clicked()), SLOT(sWoList()));
  connect(_woNumber, SIGNAL(requestList()), SLOT(sWoList()));

  setFocusProxy(_woNumber);
}
Exemplo n.º 5
0
// Destroy a call tip.
QsciSciCallTip::~QsciSciCallTip()
{
    // Ensure that the main window doesn't receive a focus out event when
    // this is destroyed.
    setFocusProxy(0);
}
Exemplo n.º 6
0
void EnrichmentDialog::initTextPage()
{
	QGroupBox *gb1 = new QGroupBox();
	QGridLayout * gl1 = new QGridLayout(gb1);
	gl1->addWidget(new QLabel(tr("Color")), 0, 0);

	textColorBtn = new ColorButton();
	connect(textColorBtn, SIGNAL(colorChanged()), this, SLOT(textFormatApplyTo()));
	gl1->addWidget(textColorBtn, 0, 1);

	textFontBtn = new QPushButton(tr( "&Font" ));
	textFontBtn->setIcon(QIcon(":/font.png"));
	connect(textFontBtn, SIGNAL(clicked()), this, SLOT(customFont()));
	gl1->addWidget(textFontBtn, 0, 2);

    gl1->addWidget(new QLabel(tr("Background")), 1, 0);
	textBackgroundBtn = new ColorButton();
	connect(textBackgroundBtn, SIGNAL(colorChanged()), this, SLOT(textFormatApplyTo()));
	gl1->addWidget(textBackgroundBtn, 1, 1);

	boxBackgroundTransparency = new QSpinBox();
	boxBackgroundTransparency->setRange(0, 100);
	boxBackgroundTransparency->setSuffix(" %");
	boxBackgroundTransparency->setWrapping(true);
	connect(boxBackgroundTransparency, SIGNAL(valueChanged(int)), this, SLOT(updateTransparency(int)));
	gl1->addWidget(boxBackgroundTransparency, 2, 1);

	transparencySlider = new QSlider();
	transparencySlider->setOrientation(Qt::Horizontal);
	transparencySlider->setRange(0, 100);

	connect(transparencySlider, SIGNAL(valueChanged(int)), boxBackgroundTransparency, SLOT(setValue(int)));
	connect(boxBackgroundTransparency, SIGNAL(valueChanged(int)), transparencySlider, SLOT(setValue(int)));

	QLabel *l1 = new QLabel("&" + tr("Opacity"));
	l1->setBuddy(transparencySlider);
	gl1->addWidget(l1, 2, 0);

	QHBoxLayout* hb = new QHBoxLayout();
	hb->addWidget(transparencySlider);
	hb->addWidget(boxBackgroundTransparency);
	gl1->addLayout(hb, 2, 1);

    boxTextAngle = new QSpinBox();
    boxTextAngle->setRange(-360, 360);
    boxTextAngle->setSingleStep(45);
    boxTextAngle->setWrapping(true);
    connect(boxTextAngle, SIGNAL(valueChanged(int)), this, SLOT(textFormatApplyTo()));
    gl1->addWidget(boxTextAngle, 3, 1);

	QLabel *l2 = new QLabel("&" + tr("Rotate (deg.)"));
	l2->setBuddy(boxTextAngle);
	gl1->addWidget(l2, 3, 0);

    autoUpdateTextBox = new QCheckBox(tr("Auto-&update"));
	gl1->addWidget(autoUpdateTextBox, 1, 2);

	texOutputBox = new QCheckBox(tr("TeX &Output"));
	gl1->addWidget(texOutputBox, 2, 2);
	connect(texOutputBox, SIGNAL(clicked()), this, SLOT(updateButtons()));

	gl1->setColumnStretch(4, 1);

    QVBoxLayout *vl = new QVBoxLayout();
    textDefaultBtn = new QPushButton( tr( "Set As &Default" ) );
    connect(textDefaultBtn, SIGNAL(clicked()), this, SLOT(setTextDefaultValues()));
	vl->addWidget(textDefaultBtn);

    textApplyToBtn = new QPushButton(tr("Apply format &to..."));
	connect(textApplyToBtn, SIGNAL(clicked()), this, SLOT(textFormatApplyTo()));
	vl->addWidget(textApplyToBtn);

	textApplyToBox = new QComboBox();
	textApplyToBox->insertItem(tr("Object"));
	textApplyToBox->insertItem(tr("Layer"));
    textApplyToBox->insertItem(tr("Window"));
    textApplyToBox->insertItem(tr("All Windows"));
	vl->addWidget(textApplyToBox);
	vl->addStretch();

    QHBoxLayout *hl = new QHBoxLayout();
	hl->addWidget(gb1);
	hl->addLayout(vl);

	textEditBox = new QTextEdit();
	textEditBox->setTextFormat(Qt::PlainText);

	formatButtons =  new TextFormatButtons(textEditBox, TextFormatButtons::Legend);

	setFocusPolicy(Qt::StrongFocus);
	setFocusProxy(textEditBox);

	textPage = new QWidget();

	QVBoxLayout* ml = new QVBoxLayout(textPage);
	ml->addLayout(hl);
	ml->addWidget(formatButtons);
	ml->addWidget(textEditBox, 1);

	tabWidget->addTab(textPage, tr( "&Text" ) );
}
Exemplo n.º 7
0
KXmlCommandSelector::KXmlCommandSelector(bool canBeNull, QWidget *parent, const char *name, KDialogBase *dlg) : QWidget(parent, name)
{
    m_cmd = new QComboBox(this);
    connect(m_cmd, SIGNAL(activated(int)), SLOT(slotCommandSelected(int)));
    QPushButton *m_add = new KPushButton(this);
    QPushButton *m_edit = new KPushButton(this);
    m_add->setPixmap(SmallIcon("filenew"));
    m_edit->setPixmap(SmallIcon("configure"));
    connect(m_add, SIGNAL(clicked()), SLOT(slotAddCommand()));
    connect(m_edit, SIGNAL(clicked()), SLOT(slotEditCommand()));
    QToolTip::add(m_add, i18n("New command"));
    QToolTip::add(m_edit, i18n("Edit command"));
    m_shortinfo = new QLabel(this);
    m_helpbtn = new KPushButton(this);
    m_helpbtn->setIconSet(SmallIconSet("help"));
    connect(m_helpbtn, SIGNAL(clicked()), SLOT(slotHelpCommand()));
    QToolTip::add(m_helpbtn, i18n("Information"));
    m_helpbtn->setEnabled(false);

    m_line = 0;
    m_usefilter = 0;
    QPushButton *m_browse = 0;

    QVBoxLayout *l0 = new QVBoxLayout(this, 0, 10);

    if(canBeNull)
    {
        m_line = new QLineEdit(this);
        m_browse = new KPushButton(KGuiItem(i18n("&Browse..."), "fileopen"), this);
        m_usefilter = new QCheckBox(i18n("Use co&mmand:"), this);
        connect(m_browse, SIGNAL(clicked()), SLOT(slotBrowse()));
        connect(m_usefilter, SIGNAL(toggled(bool)), m_line, SLOT(setDisabled(bool)));
        connect(m_usefilter, SIGNAL(toggled(bool)), m_browse, SLOT(setDisabled(bool)));
        connect(m_usefilter, SIGNAL(toggled(bool)), m_cmd, SLOT(setEnabled(bool)));
        connect(m_usefilter, SIGNAL(toggled(bool)), m_add, SLOT(setEnabled(bool)));
        connect(m_usefilter, SIGNAL(toggled(bool)), m_edit, SLOT(setEnabled(bool)));
        connect(m_usefilter, SIGNAL(toggled(bool)), m_shortinfo, SLOT(setEnabled(bool)));
        connect(m_usefilter, SIGNAL(toggled(bool)), SLOT(slotXmlCommandToggled(bool)));
        m_usefilter->setChecked(true);
        m_usefilter->setChecked(false);
        // setFocusProxy(m_line);
        setTabOrder(m_usefilter, m_cmd);
        setTabOrder(m_cmd, m_add);
        setTabOrder(m_add, m_edit);

        QHBoxLayout *l1 = new QHBoxLayout(0, 0, 10);
        l0->addLayout(l1);
        l1->addWidget(m_line);
        l1->addWidget(m_browse);

        KSeparator *sep = new KSeparator(Qt::Horizontal, this);
        l0->addWidget(sep);
    }
    else
        setFocusProxy(m_cmd);

    QGridLayout *l2 = new QGridLayout(0, 2, (m_usefilter ? 3 : 2), 0, 5);
    int c(0);
    l0->addLayout(l2);
    if(m_usefilter)
    {
        l2->addWidget(m_usefilter, 0, c++);
    }
    l2->addWidget(m_cmd, 0, c);
    QHBoxLayout *l4 = new QHBoxLayout(0, 0, 5);
    l2->addLayout(l4, 1, c);
    l4->addWidget(m_helpbtn, 0);
    l4->addWidget(m_shortinfo, 1);
    QHBoxLayout *l3 = new QHBoxLayout(0, 0, 0);
    l2->addLayout(l3, 0, c + 1);
    l3->addWidget(m_add);
    l3->addWidget(m_edit);

    if(dlg)
        connect(this, SIGNAL(commandValid(bool)), dlg, SLOT(enableButtonOK(bool)));

    loadCommands();
}
Exemplo n.º 8
0
rsx_debugger::rsx_debugger(QWidget* parent)
	: QDialog(parent)
	, m_item_count(37)
	, m_addr(0x0)
	, m_cur_texture(0)
	, exit(false)
	, palette_bg()
{
	setWindowTitle(tr("RSX Debugger"));
	setAttribute(Qt::WA_DeleteOnClose);

	//Fonts and Colors
	pSize = 8;
	mono = QFontDatabase::systemFont(QFontDatabase::FixedFont);
	mono.setPointSize(pSize);
	fontMetrics = new QFontMetrics(mono);

	palette_bg.setColor(backgroundRole(), QColor(240, 240, 240));
	QHBoxLayout* hbox_panel = new QHBoxLayout();

	//Tools
	QVBoxLayout* vbox_tools = new QVBoxLayout();

	// Controls
	QGroupBox* gb_controls = new QGroupBox(tr("RSX Debugger Controls"), this);
	QHBoxLayout* hbox_controls = new QHBoxLayout();

	// Controls: Address
	QGroupBox* gb_controls_addr = new QGroupBox(tr("Address:"), this);
	QHBoxLayout* hbox_controls_addr = new QHBoxLayout();
	t_addr = new QLineEdit();
	t_addr->setFont(mono);
	t_addr->setPlaceholderText("00000000");
	t_addr->setMaxLength(8);
	t_addr->setMaximumWidth(65);
	hbox_controls_addr->addWidget(t_addr);
	gb_controls_addr->setLayout(hbox_controls_addr);

	// Controls: Go to
	QGroupBox* gb_controls_goto = new QGroupBox(tr("Go to:"), this);
	QHBoxLayout* hbox_controls_goto = new QHBoxLayout();
	QPushButton* b_goto_get = new QPushButton(tr("Get"), this);
	QPushButton* b_goto_put = new QPushButton(tr("Put"), this);
	b_goto_get->setAutoDefault(false);
	b_goto_put->setAutoDefault(false);
	hbox_controls_goto->addWidget(b_goto_get);
	hbox_controls_goto->addWidget(b_goto_put);
	gb_controls_goto->setLayout(hbox_controls_goto);

	// Controls: Breaks
	QGroupBox* gb_controls_breaks = new QGroupBox(tr("Break on:"), this);
	QHBoxLayout* hbox_controls_breaks = new QHBoxLayout();
	QPushButton* b_break_frame = new QPushButton(tr("Frame"), this);
	QPushButton* b_break_text  = new QPushButton(tr("Texture"), this);
	QPushButton* b_break_draw  = new QPushButton(tr("Draw"), this);
	QPushButton* b_break_prim  = new QPushButton(tr("Primitive"), this);
	QPushButton* b_break_inst  = new QPushButton(tr("Command"), this);
	b_break_frame->setAutoDefault(false);
	b_break_text->setAutoDefault(false);
	b_break_draw->setAutoDefault(false);
	b_break_prim->setAutoDefault(false);
	b_break_inst->setAutoDefault(false);
	hbox_controls_breaks->addWidget(b_break_frame);
	hbox_controls_breaks->addWidget(b_break_text);
	hbox_controls_breaks->addWidget(b_break_draw);
	hbox_controls_breaks->addWidget(b_break_prim);
	hbox_controls_breaks->addWidget(b_break_inst);
	gb_controls_breaks->setLayout(hbox_controls_breaks);

	// TODO: This feature is not yet implemented
	b_break_frame->setEnabled(false);
	b_break_text->setEnabled(false);
	b_break_draw->setEnabled(false);
	b_break_prim->setEnabled(false);
	b_break_inst->setEnabled(false);
	
	hbox_controls->addWidget(gb_controls_addr);
	hbox_controls->addWidget(gb_controls_goto);
	hbox_controls->addWidget(gb_controls_breaks);
	gb_controls->setLayout(hbox_controls);


	QTabWidget* tw_rsx = new QTabWidget(this);
	tw_rsx->setFixedSize(QSize(726, 660));

	//adds a tab containing a list to the tabwidget
	auto l_addRSXTab = [=](QTableWidget* table, QString tabname, int columns)
	{
		QWidget* tab = new QWidget(tw_rsx);
		tw_rsx->addTab(tab, tabname);
		table = new QTableWidget(tab);
		table->setItemDelegate(new table_item_delegate(this));
		table->setFixedSize(QSize(720, 634));
		table->setFont(mono);
		table->setGridStyle(Qt::NoPen);
		table->setEditTriggers(QAbstractItemView::NoEditTriggers);
		table->setSelectionBehavior(QAbstractItemView::SelectRows);
		table->verticalHeader()->setVisible(false);
		table->verticalHeader()->setSectionResizeMode(QHeaderView::Fixed);
		table->verticalHeader()->setDefaultSectionSize(16);
		table->setColumnCount(columns);
		return table;
	};

	m_list_commands = l_addRSXTab(m_list_commands, tr("RSX Commands"), 4);
	m_list_captured_frame = l_addRSXTab(m_list_captured_frame, tr("Captured Frame"), 1);
	m_list_captured_draw_calls = l_addRSXTab(m_list_captured_draw_calls, tr("Captured Draw Calls"), 1);
	m_list_flags = l_addRSXTab(m_list_flags, tr("Flags"), 2);
	m_list_lightning = l_addRSXTab(m_list_lightning, tr("Lightning"), 2);
	m_list_texture = l_addRSXTab(m_list_texture, tr("Texture"), 9);
	m_list_settings = l_addRSXTab(m_list_settings, tr("Settings"), 2);

	//Tabs: List Columns
	m_list_commands->setHorizontalHeaderLabels(QStringList() << tr("Column") << tr("Value") << tr("Command") << tr("Count"));
	m_list_commands->setColumnWidth(0, 70);
	m_list_commands->setColumnWidth(1, 70);
	m_list_commands->setColumnWidth(2, 520);
	m_list_commands->setColumnWidth(3, 60);

	m_list_captured_frame->setHorizontalHeaderLabels(QStringList() << tr("Column"));
	m_list_captured_frame->setColumnWidth(0, 720);

	m_list_captured_draw_calls->setHorizontalHeaderLabels(QStringList() << tr("Draw calls"));
	m_list_captured_draw_calls->setColumnWidth(0, 720);

	m_list_flags->setHorizontalHeaderLabels(QStringList() << tr("Name") << tr("Value"));
	m_list_flags->setColumnWidth(0, 170);
	m_list_flags->setColumnWidth(1, 270);

	m_list_lightning->setHorizontalHeaderLabels(QStringList() << tr("Name") << tr("Value"));
	m_list_lightning->setColumnWidth(0, 170);
	m_list_lightning->setColumnWidth(1, 270);

	m_list_texture->setHorizontalHeaderLabels(QStringList() << tr("Index") << tr("Address") << tr("Cubemap")
		<< tr("Dimension") << tr("Enabled") << tr("Format") << tr("Mipmap") << tr("Pitch") << tr("Size"));
	for (int i = 0; i<m_list_texture->columnCount(); i++) m_list_lightning->setColumnWidth(i, 80);

	m_list_settings->setHorizontalHeaderLabels(QStringList() << tr("Name") << tr("Value"));
	m_list_settings->setColumnWidth(0, 170);
	m_list_settings->setColumnWidth(1, 270);

	// Fill list
	for(u32 i=0; i<m_item_count; i++)
	{
		m_list_commands->insertRow(m_list_commands->rowCount());
	}
	for (u32 i = 0; i<frame_debug.command_queue.size(); i++)
		m_list_captured_frame->insertRow(1);

	//Tools: Tools = Controls + Notebook Tabs
	vbox_tools->addWidget(gb_controls);
	vbox_tools->addSpacing(10);
	vbox_tools->addWidget(tw_rsx);

	// State explorer
	QHBoxLayout* hbox_state_explorer = new QHBoxLayout();
	QTabWidget* state_rsx = new QTabWidget(this);
	state_rsx->setFixedSize(QSize(726,746)); // content fits nicely

	QWidget* p_buffers = new QWidget(state_rsx);
	QWidget* p_transform_program = new QWidget(state_rsx);
	QWidget* p_shader_program = new QWidget(state_rsx);
	QWidget* p_index_buffer = new QWidget(state_rsx);

	state_rsx->addTab(p_buffers, tr("RTTs and DS"));
	state_rsx->addTab(p_transform_program, tr("Transform program"));
	state_rsx->addTab(p_shader_program, tr("Shader program"));
	state_rsx->addTab(p_index_buffer, tr("Index buffer"));

	m_text_transform_program = new QLabel(p_transform_program);
	m_text_transform_program->setFixedSize(QSize(720, 720));
	m_text_transform_program->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard);
	m_text_transform_program->setFont(mono);
	m_text_transform_program->setText("");

	m_text_shader_program = new QLabel(p_shader_program);
	m_text_shader_program->setFixedSize(QSize(720, 720));
	m_text_shader_program->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard);
	m_text_shader_program->setFont(mono);
	m_text_shader_program->setText("");

	m_list_index_buffer = new QListWidget(p_index_buffer);
	m_list_index_buffer->setFixedSize(QSize(720, 720));
	m_list_index_buffer->setFont(mono);

	//Buffers
	QVBoxLayout* vbox_buffers1 = new QVBoxLayout();
	QVBoxLayout* vbox_buffers2 = new QVBoxLayout();
	QGroupBox* gb_buffers_colorA  = new QGroupBox(tr("Color Buffer A"), p_buffers);
	QGroupBox* gb_buffers_colorB  = new QGroupBox(tr("Color Buffer B"), p_buffers);
	QGroupBox* gb_buffers_colorC  = new QGroupBox(tr("Color Buffer C"), p_buffers);
	QGroupBox* gb_buffers_colorD  = new QGroupBox(tr("Color Buffer D"), p_buffers);
	QGroupBox* gb_buffers_depth   = new QGroupBox(tr("Depth Buffer"), p_buffers);
	QGroupBox* gb_buffers_stencil = new QGroupBox(tr("Stencil Buffer"), p_buffers);
	QGroupBox* gb_buffers_text    = new QGroupBox(tr("Texture"), p_buffers);
	QHBoxLayout* hbox_buffers_colorA	= new QHBoxLayout();
	QHBoxLayout* hbox_buffers_colorB	= new QHBoxLayout();
	QHBoxLayout* hbox_buffers_colorC	= new QHBoxLayout();
	QHBoxLayout* hbox_buffers_colorD	= new QHBoxLayout();
	QHBoxLayout* hbox_buffers_depth		= new QHBoxLayout();
	QHBoxLayout* hbox_buffers_stencil	= new QHBoxLayout();
	QHBoxLayout* hbox_buffers_text		= new QHBoxLayout();
	gb_buffers_colorA	->setLayout(hbox_buffers_colorA);
	gb_buffers_colorB	->setLayout(hbox_buffers_colorB);
	gb_buffers_colorC	->setLayout(hbox_buffers_colorC);
	gb_buffers_colorD	->setLayout(hbox_buffers_colorD);
	gb_buffers_depth	->setLayout(hbox_buffers_depth);
	gb_buffers_stencil->setLayout(hbox_buffers_stencil);
	gb_buffers_text		->setLayout(hbox_buffers_text);
	
	//Buffers and textures
	m_panel_width = 108;
	m_panel_height = 108;
	m_text_width = 108;
	m_text_height = 108;

	//Panels for displaying the buffers
	m_buffer_colorA  = new Buffer(p_buffers, false, 0);
	m_buffer_colorB  = new Buffer(p_buffers, false, 1);
	m_buffer_colorC  = new Buffer(p_buffers, false, 2);
	m_buffer_colorD  = new Buffer(p_buffers, false, 3);
	m_buffer_depth   = new Buffer(p_buffers, false);
	m_buffer_stencil = new Buffer(p_buffers, false);
	m_buffer_tex     = new Buffer(p_buffers, true);
	m_buffer_colorA ->setFixedSize(QSize(m_panel_width, m_panel_height));
	m_buffer_colorB ->setFixedSize(QSize(m_panel_width, m_panel_height));
	m_buffer_colorC ->setFixedSize(QSize(m_panel_width, m_panel_height));
	m_buffer_colorD ->setFixedSize(QSize(m_panel_width, m_panel_height));
	m_buffer_depth  ->setFixedSize(QSize(m_panel_width, m_panel_height));
	m_buffer_stencil->setFixedSize(QSize(m_panel_width, m_panel_height));
	m_buffer_tex    ->setFixedSize(QSize(m_text_width, m_text_height));
	hbox_buffers_colorA ->addWidget(m_buffer_colorA);
	hbox_buffers_colorB ->addWidget(m_buffer_colorB);
	hbox_buffers_colorC ->addWidget(m_buffer_colorC);
	hbox_buffers_colorD ->addWidget(m_buffer_colorD);
	hbox_buffers_depth  ->addWidget(m_buffer_depth);
	hbox_buffers_stencil->addWidget(m_buffer_stencil);
	hbox_buffers_text   ->addWidget(m_buffer_tex);
	
	//Merge and display everything
	vbox_buffers1->addSpacing(10);
	vbox_buffers1->addWidget(gb_buffers_colorA);
	vbox_buffers1->addSpacing(10);
	vbox_buffers1->addWidget(gb_buffers_colorC);
	vbox_buffers1->addSpacing(10);
	vbox_buffers1->addWidget(gb_buffers_depth);
	vbox_buffers1->addSpacing(10);
	vbox_buffers1->addWidget(gb_buffers_text);
	vbox_buffers1->addSpacing(10);
	vbox_buffers1->addStretch();

	vbox_buffers2->addSpacing(10);
	vbox_buffers2->addWidget(gb_buffers_colorB);
	vbox_buffers2->addSpacing(10);
	vbox_buffers2->addWidget(gb_buffers_colorD);
	vbox_buffers2->addSpacing(10);
	vbox_buffers2->addWidget(gb_buffers_stencil);
	vbox_buffers2->addSpacing(10);
	vbox_buffers2->addStretch();

	hbox_state_explorer->addLayout(vbox_buffers1);
	hbox_state_explorer->addSpacing(10);
	hbox_state_explorer->addLayout(vbox_buffers2);
	hbox_state_explorer->addStretch();

	p_buffers->setLayout(hbox_state_explorer);

	hbox_panel->addLayout(vbox_tools);
	hbox_panel->addSpacing(10);
	hbox_panel->addWidget(state_rsx);
	setLayout(hbox_panel);

	//Events
	connect(b_goto_get, &QAbstractButton::clicked, [=](){
		if (const auto render = fxm::get<GSRender>()){
			u32 realAddr;
			if (RSXIOMem.getRealAddr(render->ctrl->get.load(), realAddr)){
				m_addr = realAddr;
				UpdateInformation();
			}
		}
	});
	connect(b_goto_put, &QAbstractButton::clicked, [=](){
		if (const auto render = fxm::get<GSRender>()){
			u32 realAddr;
			if (RSXIOMem.getRealAddr(render->ctrl->put.load(), realAddr)){
				m_addr = realAddr;
				UpdateInformation();
			}
		}
	});
	connect(t_addr, &QLineEdit::returnPressed, [=](){
		bool ok;
		m_addr = t_addr->text().toULong(&ok, 16);
		UpdateInformation();
	});
	connect(m_list_flags, &QTableWidget::itemClicked, this, &rsx_debugger::SetFlags);
	connect(m_list_texture, &QTableWidget::itemClicked, [=](){
		int index = m_list_texture->currentRow();
		if (index >= 0) m_cur_texture = index;
		UpdateInformation();
	});
	connect(m_list_captured_draw_calls, &QTableWidget::itemClicked, this, &rsx_debugger::OnClickDrawCalls);

	//Fill the frame
	UpdateInformation();
	setFixedSize(sizeHint());
	setFocusProxy(t_addr);
};
Exemplo n.º 9
0
CustInfo::CustInfo(QWidget *pParent, const char *name) :
  QWidget(pParent, name)
{
//  Create and place the component Widgets
  QHBoxLayout *layoutMain = new QHBoxLayout(this, 0, 6, "layoutMain"); 
  QHBoxLayout *layoutNumber = new QHBoxLayout(0, 0, 6, "layoutNumber"); 
  QHBoxLayout *layoutButtons = new QHBoxLayout(0, 0, -1, "layoutButtons"); 

  _customerNumberLit = new QLabel(tr("Customer #:"), this, "_customerNumberLit");
  _customerNumberLit->setAlignment(Qt::AlignVCenter | Qt::AlignRight);
  layoutNumber->addWidget(_customerNumberLit);

  _customerNumber = new CLineEdit(this, "_customerNumber");
  _customerNumber->setMinimumWidth(100);
  layoutNumber->addWidget(_customerNumber);
  
  _customerNumberEdit = new XLineEdit(this, "_customerNumberEdit");
  _customerNumberEdit->setMinimumWidth(100);
  _customerNumberEdit->setMaximumWidth(100);
  layoutNumber->addWidget(_customerNumberEdit);
  _customerNumberEdit->hide();
  layoutMain->addLayout(layoutNumber);

  _list = new QPushButton(tr("..."), this, "_list");
  _list->setFocusPolicy(Qt::NoFocus);
  if(_x_preferences)
  {
    if(_x_preferences->value("DefaultEllipsesAction") == "search")
      _list->setToolTip(tr("Search"));
    else
      _list->setToolTip(tr("List"));
  }
  layoutButtons->addWidget(_list);

  _info = new QPushButton(tr("?"), this, "_info");
  _info->setFocusPolicy(Qt::NoFocus);
  _info->setToolTip(tr("Open"));
  layoutButtons->addWidget(_info);
  
  _delete = new QPushButton(tr("x"), this, "_delete");
  _delete->setFocusPolicy(Qt::NoFocus);
  _delete->setToolTip(tr("Delete"));
  layoutButtons->addWidget(_delete);
  
  _new = new QPushButton(tr("+"), this, "_new");
  _new->setFocusPolicy(Qt::NoFocus);
  _new->setToolTip(tr("New"));
  layoutButtons->addWidget(_new);

  _edit = new QPushButton(tr("!"), this, "_edit");
  _edit->setFocusPolicy(Qt::NoFocus);
  _edit->setCheckable(true);
  _edit->setToolTip(tr("Edit Mode"));
  layoutButtons->addWidget(_edit);
  
#ifndef Q_WS_MAC
  _list->setMaximumWidth(25);
  _info->setMaximumWidth(25);
  _new->setMaximumWidth(25);
  _edit->setMaximumWidth(25);
  _delete->setMaximumWidth(25);
#else
  _list->setMinimumWidth(60);
  _list->setMinimumHeight(32);
  _info->setMinimumWidth(60);
  _info->setMinimumHeight(32);
  _new->setMinimumWidth(60);
  _new->setMinimumHeight(32);
  _edit->setMinimumWidth(60);
  _edit->setMinimumHeight(32);
  _delete->setMinimumWidth(60);
  _delete->setMinimumHeight(32);
  layoutNumber->setContentsMargins(2,0,0,0);
  layoutButtons->setContentsMargins(0,8,0,0);
  layoutButtons->setSpacing(6);
#endif
  
  layoutMain->addLayout(layoutButtons);

//  Make some internal connections
  connect(_list, SIGNAL(clicked()), _customerNumber, SLOT(sEllipses()));
  connect(_info, SIGNAL(clicked()), this, SLOT(sInfo()));

  connect(_customerNumber, SIGNAL(newId(int)), this, SIGNAL(newId(int)));
  connect(_customerNumber, SIGNAL(custNameChanged(const QString &)), this, SIGNAL(nameChanged(const QString &)));
  connect(_customerNumber, SIGNAL(custAddr1Changed(const QString &)), this, SIGNAL(address1Changed(const QString &)));
  connect(_customerNumber, SIGNAL(custAddr2Changed(const QString &)), this, SIGNAL(address2Changed(const QString &)));
  connect(_customerNumber, SIGNAL(custAddr3Changed(const QString &)), this, SIGNAL(address3Changed(const QString &)));
  connect(_customerNumber, SIGNAL(custCityChanged(const QString &)), this, SIGNAL(cityChanged(const QString &)));
  connect(_customerNumber, SIGNAL(custStateChanged(const QString &)), this, SIGNAL(stateChanged(const QString &)));
  connect(_customerNumber, SIGNAL(custZipCodeChanged(const QString &)), this, SIGNAL(zipCodeChanged(const QString &)));
  connect(_customerNumber, SIGNAL(custCountryChanged(const QString &)), this, SIGNAL(countryChanged(const QString &)));
  connect(_customerNumber, SIGNAL(custAddressChanged(const int)), this, SIGNAL(addressChanged(const int)));
  connect(_customerNumber, SIGNAL(custContactChanged(const int)), this, SIGNAL(contactChanged(const int)));
  connect(_customerNumber, SIGNAL(valid(bool)), this, SIGNAL(valid(bool)));

  connect(_customerNumber, SIGNAL(creditStatusChanged(const QString &)), this, SLOT(sHandleCreditStatus(const QString &)));
  connect(_customerNumber, SIGNAL(textChanged(const QString &)), _customerNumberEdit, SLOT(setText(const QString &)));
  connect(_customerNumberEdit, SIGNAL(editingFinished()), this, SIGNAL(editingFinished()));
  connect(_edit, SIGNAL(clicked()), this, SLOT(setMode()));
  connect(_new, SIGNAL(clicked()), this, SLOT(sNewClicked()));
  connect(_delete, SIGNAL(clicked()), this, SIGNAL(deleteClicked()));
  connect(_customerNumber, SIGNAL(newId(int)), this, SLOT(setMode()));

  if(_x_privileges && (!_x_privileges->check("MaintainCustomerMasters") && !_x_privileges->check("ViewCustomerMasters")))
  {
    _info->setEnabled(false);
    _delete->setEnabled(false);
    _edit->setEnabled(false);
    _new->setEnabled(false);
  }
  else
  {
    connect(_customerNumber, SIGNAL(valid(bool)), _info, SLOT(setEnabled(bool)));
    connect(_customerNumber, SIGNAL(requestInfo()), this, SLOT(sInfo()));
  }
  
  if(_x_privileges && (!_x_privileges->check("MaintainCustomerMasters") ))
  {
    _delete->setEnabled(false);
    _edit->setEnabled(false);
    _new->setEnabled(false);
  }

  setFocusProxy(_customerNumber);

  _mapper = new XDataWidgetMapper(this);
  _labelVisible = true;
  _canEdit=true;
  setCanEdit(false);
}
Exemplo n.º 10
0
FunctionDialog::FunctionDialog(ApplicationWindow *app, Graph *g, Qt::WFlags fl)
    : QDialog(g, fl), d_app(app), graph(g) {
  setObjectName("FunctionDialog");
  setWindowTitle(tr("MantidPlot - Add function curve"));
  setSizeGripEnabled(true);

  QHBoxLayout *hbox1 = new QHBoxLayout();
  hbox1->addWidget(new QLabel(tr("Curve type ")));
  boxType = new QComboBox();
  boxType->addItem(tr("Function"));
  boxType->addItem(tr("Parametric plot"));
  boxType->addItem(tr("Polar plot"));
  hbox1->addWidget(boxType);

  optionStack = new QStackedWidget();
  optionStack->setFrameShape(QFrame::StyledPanel);
  optionStack->setFrameShadow(QStackedWidget::Plain);

  QGridLayout *gl1 = new QGridLayout();
  gl1->addWidget(new QLabel(tr("f(x)= ")), 0, 0);
  boxFunction = new QTextEdit();
  boxFunction->setMinimumWidth(350);
  gl1->addWidget(boxFunction, 0, 1);
  gl1->addWidget(new QLabel(tr("From x= ")), 1, 0);
  boxFrom = new QLineEdit();
  boxFrom->setText("0");
  gl1->addWidget(boxFrom, 1, 1);
  gl1->addWidget(new QLabel(tr("To x= ")), 2, 0);
  boxTo = new QLineEdit();
  boxTo->setText("1");
  gl1->addWidget(boxTo, 2, 1);
  gl1->addWidget(new QLabel(tr("Points")), 3, 0);
  boxPoints = new QSpinBox();
  boxPoints->setRange(2, 1000000);
  boxPoints->setSingleStep(100);
  boxPoints->setValue(100);
  gl1->addWidget(boxPoints, 3, 1);

  functionPage = new QWidget();
  functionPage->setLayout(gl1);
  optionStack->addWidget(functionPage);

  QGridLayout *gl2 = new QGridLayout();
  gl2->addWidget(new QLabel(tr("Parameter")), 0, 0);
  boxParameter = new QLineEdit();
  boxParameter->setText("m");
  gl2->addWidget(boxParameter, 0, 1);
  gl2->addWidget(new QLabel(tr("From")), 1, 0);
  boxParFrom = new QLineEdit();
  boxParFrom->setText("0");
  gl2->addWidget(boxParFrom, 1, 1);
  gl2->addWidget(new QLabel(tr("To")), 2, 0);
  boxParTo = new QLineEdit();
  boxParTo->setText("1");
  gl2->addWidget(boxParTo, 2, 1);
  gl2->addWidget(new QLabel(tr("x = ")), 3, 0);
  boxXFunction = new QComboBox();
  boxXFunction->setEditable(true);
  gl2->addWidget(boxXFunction, 3, 1);
  gl2->addWidget(new QLabel(tr("y = ")), 4, 0);
  boxYFunction = new QComboBox();
  boxYFunction->setEditable(true);
  gl2->addWidget(boxYFunction, 4, 1);
  gl2->addWidget(new QLabel(tr("Points")), 5, 0);
  boxParPoints = new QSpinBox();
  boxParPoints->setRange(2, 1000000);
  boxParPoints->setSingleStep(100);
  boxParPoints->setValue(100);
  gl2->addWidget(boxParPoints, 5, 1);
  gl2->setRowStretch(6, 1);

  parametricPage = new QWidget();
  parametricPage->setLayout(gl2);
  optionStack->addWidget(parametricPage);

  QGridLayout *gl3 = new QGridLayout();
  gl3->addWidget(new QLabel(tr("Parameter")), 0, 0);
  boxPolarParameter = new QLineEdit();
  boxPolarParameter->setText("t");
  gl3->addWidget(boxPolarParameter, 0, 1);
  gl3->addWidget(new QLabel(tr("From")), 2, 0);
  boxPolarFrom = new QLineEdit();
  boxPolarFrom->setText("0");
  gl3->addWidget(boxPolarFrom, 2, 1);
  gl3->addWidget(new QLabel(tr("To")), 3, 0);
  boxPolarTo = new QLineEdit();
  boxPolarTo->setText("pi");
  gl3->addWidget(boxPolarTo, 3, 1);
  gl3->addWidget(new QLabel(tr("R =")), 4, 0);
  boxPolarRadius = new QComboBox();
  boxPolarRadius->setEditable(true);
  gl3->addWidget(boxPolarRadius, 4, 1);
  gl3->addWidget(new QLabel(tr("Theta =")), 5, 0);
  boxPolarTheta = new QComboBox();
  boxPolarTheta->setEditable(true);
  gl3->addWidget(boxPolarTheta, 5, 1);
  gl3->addWidget(new QLabel(tr("Points")), 6, 0);
  boxPolarPoints = new QSpinBox();
  boxPolarPoints->setRange(2, 1000000);
  boxPolarPoints->setSingleStep(100);
  boxPolarPoints->setValue(100);
  gl3->addWidget(boxPolarPoints, 6, 1);
  gl3->setRowStretch(7, 1);

  polarPage = new QWidget();
  polarPage->setLayout(gl3);
  optionStack->addWidget(polarPage);

  buttonClear = new QPushButton(tr("Clear Function"));
  buttonClear->setAutoDefault(false);
  buttonOk = new QPushButton(tr("Ok"));
  buttonOk->setDefault(true);
  buttonCancel = new QPushButton(tr("Close"));
  buttonCancel->setAutoDefault(false);

  QHBoxLayout *hbox2 = new QHBoxLayout();
  hbox2->addStretch();
  hbox2->addWidget(buttonClear);
  hbox2->addWidget(buttonOk);
  hbox2->addWidget(buttonCancel);

  QVBoxLayout *vbox1 = new QVBoxLayout();
  vbox1->addLayout(hbox1);
  vbox1->addWidget(optionStack);
  vbox1->addLayout(hbox2);

  setLayout(vbox1);
  setFocusProxy(boxFunction);

  connect(boxType, SIGNAL(activated(int)), this, SLOT(raiseWidget(int)));
  connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept()));
  connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
  connect(buttonClear, SIGNAL(clicked()), this, SLOT(clearList()));

  curveID = -1;
}
Exemplo n.º 11
0
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);
}
Exemplo n.º 12
0
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);
}
Exemplo n.º 13
0
bool Login::init(Datapipe *datapipe, const QString &params)
{
    this->datapipe = datapipe;
    this->params  = params;

    QHBoxLayout *mainLayout = new QHBoxLayout();
    setLayout(mainLayout);

    QSqlQuery   query;

    loglevel = datapipe->getVariables()->value(_S("loglevel")).toInt();

    query.prepare(datapipe->getSettings()->value(_S("login/queries/userslist")).toString());
    query.bindValue(":current_base_id", datapipe->getVariables()->value(_S("current_base_id")));

    if (!query.exec())
    {
        qCritical() << _T("%1 Ошибка: %2\nЗапрос: %3\nПеременные: %4")
                    .arg(posForLog,
                         query.lastError().text(),
                         query.lastQuery(),
                         Service::join(query.boundValues()));

        QMessageBox message;
        message.setText(_T("Ошибка получения списка пользователей\nТекст: %1\n").arg(query.lastError().text()));
        message.exec();

        return false;
    }

    model.setQuery(query);
    model.setHeaderData(0, Qt::Horizontal, _T("Пользователи"));

    view.setModel(&model);
    view.setSelectionMode(QAbstractItemView::SingleSelection);

    view.hideColumn(1);
    view.hideColumn(2);

    QHeaderView *header = view.verticalHeader();
    header->setDefaultSectionSize(datapipe->getVariables()->value(_S("standart_text_height")).toInt());
    header->setVisible(false);

    header = view.horizontalHeader();
    header->setStretchLastSection(true);

    view.setFocusPolicy(Qt::NoFocus);
    mainLayout->addWidget(&view);

    QVBoxLayout *numpadLayout = new QVBoxLayout();
    mainLayout->addLayout(numpadLayout);

    Numpad *npad = new Numpad(datapipe, this);
    npad->setEchoMode(QLineEdit::Password);
    numpadLayout->addWidget(npad);
    numpadLayout->addStretch();

    connect(npad, SIGNAL(inputCommited(QString)),
            this, SLOT(passwordCommited(QString)));

    setFocusProxy(npad);

    this->installEventFilter(this);

    datapipe->getVariables()->remove(_S("user"));
    datapipe->getVariables()->remove(_S("user_id"));

    return true;
}
Exemplo n.º 14
0
FindBar::FindBar(QWidget *parent)
    : QWidget(parent)
    , m_lineEdit(new QLineEdit(this))
    , m_matchCase(new QCheckBox(tr("&Match case"), this))
    , m_highlightAll(new QCheckBox(tr("&Highlight all"), this)),
      m_associatedWebView(0)
{
    QHBoxLayout *layout = new QHBoxLayout;

    // cosmetic
    layout->setContentsMargins(2, 0, 2, 0);

    // hide button
    QToolButton *hideButton = new QToolButton(this);
    hideButton->setAutoRaise(true);
    hideButton->setIcon(QIcon::fromTheme(QLatin1String("dialog-close")));
    hideButton->setShortcut(tr("Esc"));
    connect(hideButton, SIGNAL(clicked()), this, SLOT(hide()));
    layout->addWidget(hideButton);
    layout->setAlignment(hideButton, Qt::AlignLeft | Qt::AlignTop);

    // label
    QLabel *label = new QLabel(tr("Find:"));
    layout->addWidget(label);

    // Find Bar signal
    connect(this, SIGNAL(searchString(QString)), this, SLOT(find(QString)));

    // lineEdit, focusProxy
    setFocusProxy(m_lineEdit);
    m_lineEdit->setMaximumWidth(250);
    connect(m_lineEdit, SIGNAL(textChanged(QString)), this, SLOT(find(QString)));
    layout->addWidget(m_lineEdit);

    // buttons
    QPushButton *findNext = new QPushButton(QIcon::fromTheme(QLatin1String("go-down")), tr("&Next"), this);
    findNext->setShortcut(tr("F3"));
    QPushButton *findPrev = new QPushButton(QIcon::fromTheme(QLatin1String("go-up")), tr("&Previous"), this);
    findPrev->setShortcut(tr("Shift+F3"));
    connect(findNext, SIGNAL(clicked()), this, SLOT(findNext()));
    connect(findPrev, SIGNAL(clicked()), this, SLOT(findPrevious()));
    layout->addWidget(findNext);
    layout->addWidget(findPrev);

    // Case sensitivity. Deliberately set so this is off by default.
    m_matchCase->setCheckState(Qt::Unchecked);
    m_matchCase->setTristate(false);
    connect(m_matchCase, SIGNAL(toggled(bool)), this, SLOT(matchCaseUpdate()));
    layout->addWidget(m_matchCase);

    // Hightlight All. On by default
    m_highlightAll->setCheckState(Qt::Checked);
    m_highlightAll->setTristate(false);
    connect(m_highlightAll, SIGNAL(toggled(bool)), this, SLOT(updateHighlight()));
    layout->addWidget(m_highlightAll);

    // stretching widget on the left
    layout->addStretch();

    setLayout(layout);

    // we start off hidden
    hide();
}
Exemplo n.º 15
0
void
KexiDBAutoField::createEditor()
{
    if (subwidget()) {
        delete(QWidget *)subwidget();
    }

    QWidget *newSubwidget;
    //kDebug() << "widgetType:" << d->widgetType;
    switch (d->widgetType) {
    case Text:
    case Double: //! @todo setup validator
    case Integer: //! @todo setup validator
    case Date:
    case Time:
    case DateTime: {
        KexiDBLineEdit *le = new KexiDBLineEdit(this);
        newSubwidget = le;
        le->setFrame(false);
        break;
    }
    case MultiLineText:
        newSubwidget = new KexiDBTextEdit(this);
        break;
    case Boolean:
        newSubwidget = new KexiDBCheckBox(dataSource(), this);
        break;
    case Image:
        newSubwidget = new KexiDBImageBox(designMode(), this);
        break;
    case ComboBox: {
        KexiDBComboBox *cbox = new KexiDBComboBox(this);
        newSubwidget = cbox;
        cbox->setDesignMode(designMode());
        break;
    }
    default:
        newSubwidget = 0;
        changeText(d->caption);
        break;
    }

    //kDebug() << newSubwidget;
    setSubwidget(newSubwidget);   //this will also allow to declare subproperties, see KFormDesigner::WidgetWithSubpropertiesInterface
    if (newSubwidget) {
        newSubwidget->setObjectName(
            QString::fromLatin1("KexiDBAutoField_") + newSubwidget->metaObject()->className());
        dynamic_cast<KexiDataItemInterface*>(newSubwidget)->setParentDataItemInterface(this);
        dynamic_cast<KexiFormDataItemInterface*>(newSubwidget)
        ->setColumnInfo(columnInfo()); //needed at least by KexiDBImageBox
        dynamic_cast<KexiFormDataItemInterface*>(newSubwidget)
        ->setVisibleColumnInfo(visibleColumnInfo()); //needed at least by KexiDBComboBox
        newSubwidget->setProperty("dataSource", dataSource()); //needed at least by KexiDBImageBox
        KFormDesigner::DesignTimeDynamicChildWidgetHandler::childWidgetAdded(this);
        newSubwidget->show();
        d->label->setBuddy(newSubwidget);
        if (d->focusPolicyChanged) {//if focusPolicy is changed at top level, editor inherits it
            newSubwidget->setFocusPolicy(focusPolicy());
        } else {//if focusPolicy is not changed at top level, inherit it from editor
            QWidget::setFocusPolicy(newSubwidget->focusPolicy());
        }
        setFocusProxy(newSubwidget); //ok?
        if (parentWidget())
            newSubwidget->setPalette(qApp->palette());
        copyPropertiesToEditor();
    }

    setLabelPosition(labelPosition());
}
Exemplo n.º 16
0
BtBibleKeyWidget::BtBibleKeyWidget(const CSwordBibleModuleInfo *mod,
                                   CSwordVerseKey *key, QWidget *parent,
                                   const char *name)
   : QWidget(parent), m_key(key), m_dropDownHoverTimer(this)
{
    Q_UNUSED(name);

    updatelock = false;
    m_module = mod;

    setFocusPolicy(Qt::WheelFocus);

    QToolButton* clearRef = new QToolButton(this);
    clearRef->setIcon(CResMgr::icon_clearEdit());
    clearRef->setAutoRaise(true);
    clearRef->setStyleSheet("QToolButton{margin:0px;}");
    connect(clearRef, SIGNAL(clicked()), SLOT(slotClearRef()) );

    m_bookScroller = new CScrollerWidgetSet(this);

    m_textbox = new BtLineEdit( this );
    setFocusProxy(m_textbox);
    m_textbox->setContentsMargins(0, 0, 0, 0);

    m_chapterScroller = new CScrollerWidgetSet(this);
    m_verseScroller = new CScrollerWidgetSet(this);

    QHBoxLayout* m_mainLayout = new QHBoxLayout( this );
    m_mainLayout->setContentsMargins(0, 0, 0, 0);
    m_mainLayout->setSpacing(0);
    m_mainLayout->addWidget(clearRef);
    m_mainLayout->addWidget(m_bookScroller);
    m_mainLayout->addWidget(m_textbox);
    m_mainLayout->addWidget(m_chapterScroller);
    m_mainLayout->addWidget(m_verseScroller);


    setTabOrder(m_textbox, 0);
    m_dropDownButtons = new QWidget(0);
    m_dropDownButtons->setWindowFlags(Qt::Popup);
    m_dropDownButtons->setAttribute(Qt::WA_WindowPropagation);
    m_dropDownButtons->setCursor(Qt::ArrowCursor);
    QHBoxLayout *dropDownButtonsLayout(new QHBoxLayout(m_dropDownButtons));
    m_bookDropdownButton = new BtBookDropdownChooserButton(this);
    dropDownButtonsLayout->addWidget(m_bookDropdownButton, 2);
    m_chapterDropdownButton = new BtChapterDropdownChooserButton(this);
    dropDownButtonsLayout->addWidget(m_chapterDropdownButton, 1);
    m_verseDropdownButton = new BtVerseDropdownChooserButton(this);
    dropDownButtonsLayout->addWidget(m_verseDropdownButton, 1);
    dropDownButtonsLayout->setContentsMargins(0, 0, 0, 0);
    dropDownButtonsLayout->setSpacing(0);
    m_dropDownButtons->setLayout(dropDownButtonsLayout);
    m_dropDownButtons->hide();

    m_dropDownButtons->installEventFilter(this);

    m_dropDownHoverTimer.setInterval(500);
    m_dropDownHoverTimer.setSingleShot(true);
    connect(&m_dropDownHoverTimer, SIGNAL(timeout()),
            m_dropDownButtons, SLOT(hide()));

    QString scrollButtonToolTip(tr("Scroll through the entries of the list. Press the button and move the mouse to increase or decrease the item."));
    m_bookScroller->setToolTips(
        tr("Next book"),
        scrollButtonToolTip,
        tr("Previous book")
    );
    m_chapterScroller->setToolTips(
        tr("Next chapter"),
        scrollButtonToolTip,
        tr("Previous chapter")
    );
    m_verseScroller->setToolTips(
        tr("Next verse"),
        scrollButtonToolTip,
        tr("Previous verse")
    );

    // signals and slots connections

    connect(m_bookScroller, SIGNAL(change(int)), SLOT(slotStepBook(int)));
    connect(m_bookScroller, SIGNAL(scroller_pressed()), SLOT(slotUpdateLock()));
    connect(m_bookScroller, SIGNAL(scroller_released()), SLOT(slotUpdateUnlock()));
    connect(m_textbox, SIGNAL(returnPressed()), SLOT(slotReturnPressed()));
    connect(m_chapterScroller, SIGNAL(change(int)), SLOT(slotStepChapter(int)));
    connect(m_chapterScroller, SIGNAL(scroller_pressed()), SLOT(slotUpdateLock()));
    connect(m_chapterScroller, SIGNAL(scroller_released()), SLOT(slotUpdateUnlock()));
    connect(m_verseScroller, SIGNAL(change(int)), SLOT(slotStepVerse(int)));
    connect(m_verseScroller, SIGNAL(scroller_pressed()), SLOT(slotUpdateLock()));
    connect(m_verseScroller, SIGNAL(scroller_released()), SLOT(slotUpdateUnlock()));
    bool ok = connect(m_key->afterChangedSignaller(), SIGNAL(signal()), this, SLOT(updateText()));
    Q_ASSERT(ok);

    setKey(key);    // The order of these two functions is important.
    setModule();
}
Exemplo n.º 17
0
void AddressCluster::init()
{
    _titleSingular = tr("Address");
    _titlePlural   = tr("Addresses");
    _query = "SELECT * FROM addr ";

    // handle differences between VirtualCluster and AddressCluster
    _grid->removeWidget(_label);
    _grid->removeWidget(_description);
    _grid->removeWidget(_list);
    _grid->removeWidget(_info);
    delete _description;

    _number        = new QLineEdit(this);
    _addrLit       = new QLabel(tr("Street\nAddress:"), this);
    _addr1         = new QLineEdit(this);
    _addr2         = new QLineEdit(this);
    _addr3         = new QLineEdit(this);
    _cityLit       = new QLabel(tr("City:"), this);
    _city          = new QLineEdit(this);
    _stateLit      = new QLabel(tr("State:"));
    _state         = new XComboBox(this);
    _postalcodeLit = new QLabel(tr("Postal Code:"));
    _postalcode    = new QLineEdit(this);
    _countryLit    = new QLabel(tr("Country:"));
    _country       = new XComboBox(this);
    _active        = new QCheckBox(tr("Active"), this);
    _mapper        = new XDataWidgetMapper(this);

    _number->hide();
    _addrLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    _cityLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    _stateLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    _state->setEditable(true);
    _country->setEditable(true);
    _country->setMaximumWidth(250);
    _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,       4, 0);
    _grid->addWidget(_city,          4, 1);
    _grid->addWidget(_stateLit,      4, 2);
    _grid->addWidget(_state,         4, 3);
    _grid->addWidget(_postalcodeLit, 4, 4);
    _grid->addWidget(_postalcode,    4, 5, 1, 2);
    _grid->addWidget(_countryLit,    5, 0);
    _grid->addWidget(_country,       5, 1, 1, 3);
    _grid->addWidget(_active,        5, 4);

    QHBoxLayout* hbox = new QHBoxLayout;
    hbox->addWidget(_list);
    hbox->addWidget(_info);
    _grid->addLayout(hbox, 5, 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);

    connect(_list,      SIGNAL(clicked()), this, SLOT(sEllipses()));
    connect(_info,      SIGNAL(clicked()), this, SLOT(sInfo()));
    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(_postalcode,SIGNAL(textChanged(const QString&)), this, SIGNAL(changed()));
    connect(_country,   SIGNAL(editTextChanged(const QString&)), this, SIGNAL(changed()));

    setFocusProxy(_addr1);
    setFocusPolicy(Qt::StrongFocus);
    setLabel("");
    setActiveVisible(false);
    setInfoVisible(false); // TODO - remove this and implement Info button
    silentSetId(-1);
}
Exemplo n.º 18
0
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;
}
Exemplo n.º 19
0
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);
}
Exemplo n.º 20
0
void ValueEdit::setValue( const NifValue & v )
{
    typ = v.type();

    if ( edit )
    {
        // segfaults with Qt 4.5:
        //delete edit;
        edit = 0;
        resize( this->baseSize() );
    }

    switch ( typ )
    {
    case NifValue::tByte:
    {
        QSpinBox * be = new QSpinBox( this );
        be->setFrame(false);
        be->setRange( 0, 0xff );
        be->setValue( v.toCount() );
        edit = be;
    }
    break;
    case NifValue::tWord:
    case NifValue::tFlags:
    {
        QSpinBox * we = new QSpinBox( this );
        we->setFrame(false);
        we->setRange( 0, 0xffff );
        we->setValue( v.toCount() );
        edit = we;
    }
    break;
    case NifValue::tShort:
    {
        QSpinBox * we = new QSpinBox( this );
        we->setFrame(false);
        we->setRange( SHRT_MIN, SHRT_MAX );
        we->setValue( (short)v.toCount() );
        edit = we;
    }
    break;
    case NifValue::tInt:
    {
        QSpinBox * ie = new QSpinBox( this );
        ie->setFrame(false);
        ie->setRange( INT_MIN, INT_MAX );
        ie->setValue( (int)v.toCount() );
        edit = ie;
    }
    break;
    case NifValue::tStringIndex:
    {
        QSpinBox * ie = new QSpinBox( this );
        ie->setFrame(false);
        ie->setRange( -1, INT_MAX );
        ie->setValue( (int)v.toCount() );
        edit = ie;
    }
    break;
    case NifValue::tUInt:
    {
        QSpinBox * ie = new UIntSpinBox( this );
        ie->setFrame(false);
        ie->setValue( v.toCount() );
        edit = ie;
    }
    break;
    case NifValue::tLink:
    case NifValue::tUpLink:
    {
        QLineEdit * le = new QLineEdit( this );
        int tmp = v.toLink();
        if ( tmp > 0 ) {
            le->setText( QString::number(tmp) );
        }
        edit = le;
    }
    break;
    case NifValue::tFloat:
    {
        FloatEdit * fe = new FloatEdit( this );
        /*
        fe->setFrame(false);
        fe->setRange( -1e10, +1e10 );
        fe->setDecimals( 4 );
        */
        fe->setValue( v.toFloat() );
        edit = fe;
    }
    break;

    case NifValue::tText:
    case NifValue::tSizedString:
    {
        TextEdit * te = new TextEdit( v.toString(), this );
        te->resize( size() );
        connect( te, SIGNAL( sigResized(QResizeEvent *) ), this, SLOT( childResized(QResizeEvent *) ) );
        edit = te;
    }
    break;
    case NifValue::tLineString:
    case NifValue::tShortString:
    case NifValue::tChar8String:
    {
        QLineEdit * le = new QLineEdit( this );
        le->setText( v.toString() );
        edit = le;
    }
    break;
    //case NifValue::tText:
    //{
    //	TextEdit * te = new TextEdit( v.toString(), this );
    //	te->setMinimumSize( width(), height() );
    //	te->setBaseSize( width(), height() * 5);
    //	edit = te;
    //}	break;
    case NifValue::tColor4:
    {
        ColorEdit * ce = new ColorEdit( this );
        ce->setColor4( v.get<Color4>() );
        edit = ce;
    }
    break;
    case NifValue::tColor3:
    {
        ColorEdit * ce = new ColorEdit( this );
        ce->setColor3( v.get<Color3>() );
        edit = ce;
    }
    break;
    case NifValue::tVector4:
    {
        VectorEdit * ve = new VectorEdit( this );
        ve->setVector4( v.get<Vector4>() );
        edit = ve;
    }
    break;
    case NifValue::tVector3:
    {
        VectorEdit * ve = new VectorEdit( this );
        ve->setVector3( v.get<Vector3>() );
        edit = ve;
    }
    break;
    case NifValue::tVector2:
    {
        VectorEdit * ve = new VectorEdit( this );
        ve->setVector2( v.get<Vector2>() );
        edit = ve;
    }
    break;
    case NifValue::tMatrix:
    {
        RotationEdit * re = new RotationEdit( this );
        re->setMatrix( v.get<Matrix>() );
        edit = re;
    }
    break;
    case NifValue::tQuat:
    case NifValue::tQuatXYZW:
    {
        RotationEdit * re = new RotationEdit( this );
        re->setQuat( v.get<Quat>() );
        edit = re;
    }
    break;
    case NifValue::tTriangle:
    {
        TriangleEdit * te = new TriangleEdit( this );
        te->setTriangle( v.get<Triangle>() );
        edit = te;
    }
    break;
    case NifValue::tString:
    {
        if (/*???*/false)
        {
            QSpinBox * ie = new UIntSpinBox( this );
            ie->setFrame(false);
            ie->setValue( v.toCount() );
            edit = ie;
        }
        else
        {
            QLineEdit * le = new QLineEdit( this );
            le->setText( v.toString() );
            edit = le;
        }
    }
    break;
    case NifValue::tFilePath:
    {
        if (/*???*/false)
        {
            QSpinBox * ie = new UIntSpinBox( this );
            ie->setFrame(false);
            ie->setValue( v.toCount() );
            edit = ie;
        }
        else
        {
            QLineEdit * le = new QLineEdit( this );
            le->setText( v.toString() );
            edit = le;
        }
    }
    break;
    default:
        edit = 0;
        break;
    }

    resizeEditor();

    setFocusProxy( edit );
}
Exemplo n.º 21
0
Plot::Plot(QWidget *parent, const char *name)
		: QwtPlot(parent)
{
marker_key = 0;
curve_key = 0;

minTickLength = 5;
majTickLength = 9;

movedGraph=FALSE;
graphToResize=FALSE;
ShiftButton=FALSE;

setGeometry(QRect(0,0,500,400));
setAxisTitle(QwtPlot::yLeft, tr("Y Axis Title"));
setAxisTitle(QwtPlot::xBottom, tr("X Axis Title"));	

// grid 
d_grid = new Grid;
d_grid->enableX(false);
d_grid->enableY(false);
d_grid->setMajPen(QPen(Qt::blue, 0, Qt::SolidLine));
d_grid->setMinPen(QPen(Qt::gray, 0 , Qt::DotLine));
d_grid->attach(this);

//custom scale
for (int i= 0; i<QwtPlot::axisCnt; i++)
	{
	QwtScaleWidget *scale = (QwtScaleWidget *) axisWidget(i);
	if (scale)
		{
		scale->setMargin(0);

		//the axis title color must be initialized
		QwtText title = scale->title();
		title.setColor(Qt::black);
		scale->setTitle(title);

		ScaleDraw *sd = new ScaleDraw();
		sd->setTickLength  	(QwtScaleDiv::MinorTick, minTickLength); 
		sd->setTickLength  	(QwtScaleDiv::MediumTick, minTickLength);
		sd->setTickLength  	(QwtScaleDiv::MajorTick, majTickLength);

		setAxisScaleDraw (i, sd);
		}
	}
	
QwtPlotLayout *pLayout=plotLayout();
pLayout->setCanvasMargin(0);

QwtPlotCanvas* plCanvas = canvas();
plCanvas->setFocusPolicy(QWidget::StrongFocus);
plCanvas->setFocusIndicator(QwtPlotCanvas::ItemFocusIndicator);
plCanvas->setFocus();
plCanvas->setFrameShadow(QwtPlot::Plain);
plCanvas->setCursor(Qt::arrowCursor);
plCanvas->setLineWidth(0);

setFocusPolicy(QWidget::StrongFocus);
setFocusProxy(plCanvas);
setFrameShape (QFrame::Box);
setLineWidth(0);
}
Exemplo n.º 22
0
WebTab::WebTab(QWidget *parent, bool isPrivateBrowsing)
    : QWidget(parent)
    , m_webView(0)
    , m_progress(0)
    , m_part(0)
    , m_zoomFactor(ReKonfig::defaultZoom())
    , m_isPrivateBrowsing(isPrivateBrowsing)
    , m_isWebApp(false)
    , m_splitter(new QSplitter(this))
#ifdef HAVE_KACTIVITIES
    , m_activityResourceInstance(0)
#endif
{
    setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

    QVBoxLayout *l = new QVBoxLayout(this);
    l->setMargin(0);
    l->setSpacing(0);

    m_splitter->addWidget(view());
    view()->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

    // NOTE: setting web inspector vertical/horizontal
    m_splitter->setOrientation(Qt::Vertical);

    l->addWidget(m_splitter);

    // fix focus handling
    setFocusProxy(view());


    KWebWallet *wallet = page()->wallet();

    if (wallet)
    {
        connect(wallet, SIGNAL(saveFormDataRequested(QString,QUrl)),
                this, SLOT(createWalletBar(QString,QUrl)));
    }

    // Connect webview signals with related webtab ones
    connect(view(), SIGNAL(loadFinished(bool)),     this, SIGNAL(loadFinished(bool)));
    connect(view(), SIGNAL(loadProgress(int)),      this, SIGNAL(loadProgress(int)));
    connect(view(), SIGNAL(loadStarted()),          this, SIGNAL(loadStarted()));
    connect(view(), SIGNAL(urlChanged(QUrl)),       this, SIGNAL(urlChanged(QUrl)));
    connect(view(), SIGNAL(titleChanged(QString)),  this, SIGNAL(titleChanged(QString)));
    connect(view(), SIGNAL(iconChanged()),          this, SIGNAL(iconChanged()));
    
    connect(page(), SIGNAL(initialUrl(QUrl)),       this, SIGNAL(urlChanged(QUrl)));

    if (!parent)
    {
        m_isWebApp = true;
        connect(this, SIGNAL(titleChanged(QString)), this, SLOT(webAppTitleChanged(QString)));
        connect(this, SIGNAL(iconChanged()), this, SLOT(webAppIconChanged()));
    }

    connect(view(), SIGNAL(loadProgress(int)),  this, SLOT(updateProgress(int)));
    connect(view(), SIGNAL(loadStarted()),      this, SLOT(resetProgress()));
    connect(view(), SIGNAL(loadFinished(bool)), this, SLOT(loadFinished()));
    connect(view(), SIGNAL(zoomChanged(int)),   this, SLOT(setZoom(int)));
    
    // Session Manager
    connect(view(), SIGNAL(loadFinished(bool)), SessionManager::self(), SLOT(saveSession()));
    
#ifdef HAVE_KACTIVITIES
    if (m_isPrivateBrowsing)
        return;
    
    m_activityResourceInstance = new KActivities::ResourceInstance(window()->winId(), this);
    
    connect(this, SIGNAL(urlChanged(QUrl)), m_activityResourceInstance, SLOT(setUri(QUrl)));
    connect(this, SIGNAL(titleChanged(QString)), m_activityResourceInstance, SLOT(setTitle(QString)));
#endif
}
Exemplo n.º 23
0
void WomatlCluster::constructor()
{
  _valid  = FALSE;
  _id     = -1;
  _woid   = -1;
  _type   = (Push | Pull | Mixed);

  _source = WoMaterial;
  _sourceId = -1;

  _required = 0.0;
  _issued = 0.0;

//  Create the component Widgets
  QLabel *itemNumberLit = new QLabel(tr("Component Item Number:"), this, "itemNumberLit");
  itemNumberLit->setGeometry(0, 0, 140, 25);
  itemNumberLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter);

  _itemNumber = new XComboBox(this, "_itemNumber");
  _itemNumber->setGeometry(145, 0, 120, 25);
  _itemNumber->setAllowNull(TRUE);

  QLabel *uomLit = new QLabel(tr("UOM:"), this, "uomLit");
  uomLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter);

  _uom = new QLabel(this, "_uom");
  _uom->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);

  _descrip1 = new QLabel(this, "_descrip1");
  _descrip1->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);

  _descrip2 = new QLabel(this, "_descrip2");
  _descrip2->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);

  QLabel *qtyPerLit = new QLabel(tr("Qty. Per:"), this, "qtyPerLit");
  qtyPerLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter);

  _qtyPer = new QLabel(this, "_qtyPer");
  _qtyPer->setAlignment(Qt::AlignRight | Qt::AlignVCenter);

  QLabel *scrapLit = new QLabel(tr("Scrap %:"), this, "scrapLit");
  scrapLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter);

  _scrap = new QLabel(this, "_scrap");
  _scrap->setAlignment(Qt::AlignRight | Qt::AlignVCenter);

  QLabel *qtyRequiredLit = new QLabel(tr("Qty. Required:"), this, "qtyRequiredLit");
  qtyRequiredLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter);

  _qtyRequired = new QLabel(this, "_qtyRequired");
  _qtyRequired->setAlignment(Qt::AlignRight | Qt::AlignVCenter);

  QLabel *qtyIssuedLit = new QLabel(tr("Qty. Issued:"), this, "qtyIssuedLit");
  qtyIssuedLit->setAlignment(Qt::AlignRight | Qt::AlignVCenter);

  _qtyIssued = new QLabel(this, "_qtyIssued");
  _qtyIssued->setAlignment(Qt::AlignRight | Qt::AlignVCenter);

  // lay out the component widgets
  Q3VBoxLayout *clusterLyt    = new Q3VBoxLayout(this, 5, -1, "clusterLyt");
  Q3HBoxLayout *itemMainLyt   = new Q3HBoxLayout(clusterLyt, -1, "itemMainLyt");
  Q3HBoxLayout *itemDescLyt   = new Q3HBoxLayout(clusterLyt, -1, "itemDescLyt");
  Q3HBoxLayout *qtyHBoxLyt    = new Q3HBoxLayout(clusterLyt, -1, "qtyHBoxLyt");
  Q3VBoxLayout *qtyLitVBoxLyt = new Q3VBoxLayout(qtyHBoxLyt, -1, "qtyLitVBoxLyt");
  Q3VBoxLayout *qtyVBoxLyt    = new Q3VBoxLayout(qtyHBoxLyt, -1, "qtyVBoxLyt");

  itemMainLyt->addWidget(itemNumberLit);
  itemMainLyt->addWidget(_itemNumber);
  itemMainLyt->addWidget(uomLit);
  itemMainLyt->addWidget(_uom);
  itemDescLyt->addWidget(_descrip1);
  itemDescLyt->addWidget(_descrip2);

  qtyLitVBoxLyt->addWidget(qtyPerLit);
  qtyLitVBoxLyt->addWidget(scrapLit);
  qtyLitVBoxLyt->addWidget(qtyRequiredLit);
  qtyLitVBoxLyt->addWidget(qtyIssuedLit);
  qtyVBoxLyt->addWidget(_qtyPer);
  qtyVBoxLyt->addWidget(_scrap);
  qtyVBoxLyt->addWidget(_qtyRequired);
  qtyVBoxLyt->addWidget(_qtyIssued);

  connect(_itemNumber, SIGNAL(newID(int)), SLOT(sPopulateInfo(int)));

  setFocusProxy(_itemNumber);
}
Exemplo n.º 24
0
ItemCluster::ItemCluster(QWidget *pParent, const char *name) : QWidget(pParent)
{
    setObjectName(name);

//  Create the component Widgets
    QVBoxLayout *mainLayout  = new QVBoxLayout();
    mainLayout->setMargin(0);
    mainLayout->setSpacing(2);
    QHBoxLayout *itemLayout  = new QHBoxLayout();
    itemLayout->setMargin(0);
    itemLayout->setSpacing(5);
    QHBoxLayout *uomLayout   = new QHBoxLayout();
    uomLayout->setMargin(0);
    uomLayout->setSpacing(5);
    QHBoxLayout *line1Layout = new QHBoxLayout();
    line1Layout->setMargin(0);
    line1Layout->setSpacing(7);

    QLabel *_itemNumberLit = new QLabel(tr("Item Number:"), this, "_itemNumberLit");
    _itemNumberLit->setAlignment(Qt::AlignVCenter | Qt::AlignRight);
    itemLayout->addWidget(_itemNumberLit);

    _itemNumber = new ItemLineEdit(this, "_itemNumber");
    _itemNumber->setMinimumWidth(100);
    itemLayout->addWidget(_itemNumber);

    _itemList = new QPushButton(tr("..."), this, "_itemList");
#ifndef Q_WS_MAC
    _itemList->setMaximumWidth(25);
#else
    _itemList->setMinimumWidth(60);
    _itemList->setMinimumHeight(32);
#endif
    _itemList->setFocusPolicy(Qt::NoFocus);
    itemLayout->addWidget(_itemList);
    line1Layout->addLayout(itemLayout);

    QLabel *_uomLit = new QLabel(tr("UOM:"), this, "_uomLit");
    _uomLit->setAlignment(Qt::AlignVCenter | Qt::AlignRight);
    uomLayout->addWidget(_uomLit);

    _uom = new QLabel(this, "_uom");
    _uom->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
    _uom->setAlignment(Qt::AlignVCenter | Qt::AlignLeft);
    _uom->setMinimumWidth(50);
    uomLayout->addWidget(_uom);
    line1Layout->addLayout(uomLayout);
    mainLayout->addLayout(line1Layout);

    _descrip1 = new QLabel(this, "_descrip1");
    _descrip1->setAlignment(Qt::AlignVCenter | Qt::AlignLeft);
    mainLayout->addWidget(_descrip1);

    _descrip2 = new QLabel(this, "_descrip2");
    _descrip2->setAlignment(Qt::AlignVCenter | Qt::AlignLeft);
    mainLayout->addWidget(_descrip2);
    setLayout(mainLayout);

//  Make some internal connections
    connect(_itemNumber, SIGNAL(aliasChanged(const QString &)), this, SIGNAL(aliasChanged(const QString &)));
    connect(_itemNumber, SIGNAL(privateIdChanged(int)), this, SIGNAL(privateIdChanged(int)));
    connect(_itemNumber, SIGNAL(newId(int)), this, SIGNAL(newId(int)));
    connect(_itemNumber, SIGNAL(valid(bool)), this, SIGNAL(valid(bool)));
    connect(_itemNumber, SIGNAL(warehouseIdChanged(int)), this, SIGNAL(warehouseIdChanged(int)));
    connect(_itemNumber, SIGNAL(typeChanged(const QString &)), this, SIGNAL(typeChanged(const QString &)));
    connect(_itemNumber, SIGNAL(configured(bool)), this, SIGNAL(configured(bool)));

    connect(_itemNumber, SIGNAL(uomChanged(const QString &)), _uom, SLOT(setText(const QString &)));
    connect(_itemNumber, SIGNAL(descrip1Changed(const QString &)), _descrip1, SLOT(setText(const QString &)));
    connect(_itemNumber, SIGNAL(descrip2Changed(const QString &)), _descrip2, SLOT(setText(const QString &)));

    connect(_itemList, SIGNAL(clicked()), _itemNumber, SLOT(sEllipses()));

    setFocusProxy(_itemNumber);
}
Exemplo n.º 25
0
TabDeckEditor::TabDeckEditor(TabSupervisor *_tabSupervisor, QWidget *parent)
    : Tab(_tabSupervisor, parent), modified(false)
{
    aClearFilterAll = new QAction(QString(), this);
    aClearFilterAll->setIcon(QIcon(":/resources/icon_clearsearch.svg"));
    connect(aClearFilterAll, SIGNAL(triggered()), this, SLOT(actClearFilterAll()));

    aClearFilterOne = new QAction(QString(), this);
    aClearFilterOne->setIcon(QIcon(":/resources/decrement.svg"));
    connect(aClearFilterOne, SIGNAL(triggered()), this, SLOT(actClearFilterOne()));

    searchEdit = new SearchLineEdit;
#if QT_VERSION >= 0x050300
    searchEdit->addAction(QIcon(":/resources/icon_search_black.svg"), QLineEdit::LeadingPosition);
#endif
    searchEdit->setObjectName("searchEdit");
    
    setFocusProxy(searchEdit);
    setFocusPolicy(Qt::ClickFocus);

    searchEdit->installEventFilter(&searchKeySignals);
    connect(searchEdit, SIGNAL(textChanged(const QString &)), this, SLOT(updateSearch(const QString &)));
    connect(&searchKeySignals, SIGNAL(onEnter()), this, SLOT(actAddCard()));
    connect(&searchKeySignals, SIGNAL(onCtrlAltEqual()), this, SLOT(actAddCard()));
    connect(&searchKeySignals, SIGNAL(onCtrlAltRBracket()), this, SLOT(actAddCardToSideboard()));
    connect(&searchKeySignals, SIGNAL(onCtrlAltMinus()), this, SLOT(actDecrementCard()));
    connect(&searchKeySignals, SIGNAL(onCtrlAltLBracket()), this, SLOT(actDecrementCardFromSideboard()));
    connect(&searchKeySignals, SIGNAL(onCtrlAltEnter()), this, SLOT(actAddCardToSideboard()));
    connect(&searchKeySignals, SIGNAL(onCtrlEnter()), this, SLOT(actAddCardToSideboard()));

    QToolBar *deckEditToolBar = new QToolBar;
    deckEditToolBar->setOrientation(Qt::Horizontal);
    deckEditToolBar->setIconSize(QSize(24, 24));

    QHBoxLayout *searchLayout = new QHBoxLayout;
    searchLayout->addWidget(deckEditToolBar);
    searchLayout->addWidget(searchEdit);

    databaseModel = new CardDatabaseModel(db, this);
    databaseDisplayModel = new CardDatabaseDisplayModel(this);
    databaseDisplayModel->setSourceModel(databaseModel);
    databaseDisplayModel->setFilterKeyColumn(0);
    databaseDisplayModel->sort(0, Qt::AscendingOrder);

    databaseView = new QTreeView();
    databaseView->setFocusProxy(searchEdit);
    databaseView->setModel(databaseDisplayModel);
    databaseView->setUniformRowHeights(true);
    databaseView->setRootIsDecorated(false);
    databaseView->setAlternatingRowColors(true);
    databaseView->setSortingEnabled(true);
    databaseView->sortByColumn(0, Qt::AscendingOrder);
    databaseView->resizeColumnToContents(0);
    connect(databaseView->selectionModel(), SIGNAL(currentRowChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(updateCardInfoLeft(const QModelIndex &, const QModelIndex &)));
    connect(databaseView, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(actAddCard()));
    searchEdit->setTreeView(databaseView);

    QVBoxLayout *leftFrame = new QVBoxLayout;
    leftFrame->addLayout(searchLayout);
    leftFrame->addWidget(databaseView);

    cardInfo = new CardFrame(250, 372);

    filterModel = new FilterTreeModel();
    databaseDisplayModel->setFilterTree(filterModel->filterTree());
    filterView = new QTreeView;
    filterView->setModel(filterModel);
    filterView->setMaximumWidth(250);
    filterView->setUniformRowHeights(true);
    filterView->setHeaderHidden(true);
    filterView->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(filterModel, SIGNAL(layoutChanged()), filterView, SLOT(expandAll()));
    connect(filterView, SIGNAL(customContextMenuRequested(const QPoint &)),
            this, SLOT(filterViewCustomContextMenu(const QPoint &)));
    FilterBuilder *filterBuilder = new FilterBuilder;
    connect(filterBuilder, SIGNAL(add(const CardFilter *)), filterModel, SLOT(addFilter(const CardFilter *)));

    QToolButton *filterDelOne = new QToolButton();
    filterDelOne->setDefaultAction(aClearFilterOne);
    filterDelOne->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);

    QToolButton *filterDelAll = new QToolButton();
    filterDelAll->setDefaultAction(aClearFilterAll);
    filterDelAll->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);

    QGridLayout *filterLayout = new QGridLayout;
    filterLayout->addWidget(filterBuilder, 0, 0, 1, 2);
    filterLayout->addWidget(filterView, 1, 0, 1, 2);
    filterLayout->addWidget(filterDelOne, 2, 0);
    filterLayout->addWidget(filterDelAll, 2, 1);

    filterBox = new QGroupBox();
    filterBox->setMaximumWidth(250);
    filterBox->setLayout(filterLayout);

    QVBoxLayout *middleFrame = new QVBoxLayout;
    middleFrame->addWidget(cardInfo, 1, Qt::AlignTop);
    middleFrame->addWidget(filterBox, 0);

    deckModel = new DeckListModel(this);
    connect(deckModel, SIGNAL(deckHashChanged()), this, SLOT(updateHash()));
    deckView = new QTreeView();
    deckView->setModel(deckModel);
    deckView->setUniformRowHeights(true);
    deckView->setSortingEnabled(true);
    deckView->sortByColumn(1, Qt::AscendingOrder);
#if QT_VERSION < 0x050000
    deckView->header()->setResizeMode(QHeaderView::ResizeToContents);
#else
    deckView->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
#endif
    deckView->installEventFilter(&deckViewKeySignals);
    connect(deckView->selectionModel(), SIGNAL(currentRowChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(updateCardInfoRight(const QModelIndex &, const QModelIndex &)));
    connect(deckView, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(actSwapCard()));
    connect(&deckViewKeySignals, SIGNAL(onS()), this, SLOT(actSwapCard()));
    connect(&deckViewKeySignals, SIGNAL(onEnter()), this, SLOT(actIncrement()));
    connect(&deckViewKeySignals, SIGNAL(onCtrlAltEqual()), this, SLOT(actIncrement()));
    connect(&deckViewKeySignals, SIGNAL(onCtrlAltMinus()), this, SLOT(actDecrement()));
    connect(&deckViewKeySignals, SIGNAL(onRight()), this, SLOT(actIncrement()));
    connect(&deckViewKeySignals, SIGNAL(onLeft()), this, SLOT(actDecrement()));
    connect(&deckViewKeySignals, SIGNAL(onDelete()), this, SLOT(actRemoveCard()));

    nameLabel = new QLabel();
    nameEdit = new QLineEdit;
    nameLabel->setBuddy(nameEdit);
    connect(nameEdit, SIGNAL(textChanged(const QString &)), this, SLOT(updateName(const QString &)));
    commentsLabel = new QLabel();
    commentsEdit = new QTextEdit;
    commentsEdit->setMaximumHeight(70);
    commentsLabel->setBuddy(commentsEdit);
    connect(commentsEdit, SIGNAL(textChanged()), this, SLOT(updateComments()));
    hashLabel1 = new QLabel();
    hashLabel = new QLabel;

    QGridLayout *grid = new QGridLayout;
    grid->addWidget(nameLabel, 0, 0);
    grid->addWidget(nameEdit, 0, 1);

    grid->addWidget(commentsLabel, 1, 0);
    grid->addWidget(commentsEdit, 1, 1);

    grid->addWidget(hashLabel1, 2, 0);
    grid->addWidget(hashLabel, 2, 1);

    /* Update price
    aUpdatePrices = new QAction(QString(), this);
    aUpdatePrices->setIcon(QIcon(":/resources/icon_update.png"));
    connect(aUpdatePrices, SIGNAL(triggered()), this, SLOT(actUpdatePrices()));
    if (!settingsCache->getPriceTagFeature())
        aUpdatePrices->setVisible(false);
    connect(settingsCache, SIGNAL(priceTagFeatureChanged(int)), this, SLOT(setPriceTagFeatureEnabled(int)));
    */

    QToolBar *deckToolBar = new QToolBar;
    deckToolBar->setOrientation(Qt::Vertical);
    deckToolBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    deckToolBar->setIconSize(QSize(24, 24));
    //deckToolBar->addAction(aUpdatePrices);
    QHBoxLayout *deckToolbarLayout = new QHBoxLayout;
    deckToolbarLayout->addStretch();
    deckToolbarLayout->addWidget(deckToolBar);
    deckToolbarLayout->addStretch();

    QVBoxLayout *rightFrame = new QVBoxLayout;
    rightFrame->addLayout(grid);
    rightFrame->addWidget(deckView, 10);
    rightFrame->addLayout(deckToolbarLayout);

    QHBoxLayout *mainLayout = new QHBoxLayout;
    mainLayout->addLayout(leftFrame, 10);
    mainLayout->addLayout(middleFrame);
    mainLayout->addLayout(rightFrame);
    setLayout(mainLayout);

    aNewDeck = new QAction(QString(), this);
    aNewDeck->setShortcuts(QKeySequence::New);
    connect(aNewDeck, SIGNAL(triggered()), this, SLOT(actNewDeck()));
    aLoadDeck = new QAction(QString(), this);
    aLoadDeck->setShortcuts(QKeySequence::Open);
    connect(aLoadDeck, SIGNAL(triggered()), this, SLOT(actLoadDeck()));
    aSaveDeck = new QAction(QString(), this);
    aSaveDeck->setShortcuts(QKeySequence::Save);
    connect(aSaveDeck, SIGNAL(triggered()), this, SLOT(actSaveDeck()));
    aSaveDeckAs = new QAction(QString(), this);
//    aSaveDeckAs->setShortcuts(QKeySequence::SaveAs);
    connect(aSaveDeckAs, SIGNAL(triggered()), this, SLOT(actSaveDeckAs()));
    aLoadDeckFromClipboard = new QAction(QString(), this);
    connect(aLoadDeckFromClipboard, SIGNAL(triggered()), this, SLOT(actLoadDeckFromClipboard()));
    aLoadDeckFromClipboard->setShortcuts(QKeySequence::Paste);
    aSaveDeckToClipboard = new QAction(QString(), this);
    connect(aSaveDeckToClipboard, SIGNAL(triggered()), this, SLOT(actSaveDeckToClipboard()));
    aSaveDeckToClipboard->setShortcuts(QKeySequence::Copy);
    aPrintDeck = new QAction(QString(), this);
    aPrintDeck->setShortcuts(QKeySequence::Print);
    connect(aPrintDeck, SIGNAL(triggered()), this, SLOT(actPrintDeck()));
    aAnalyzeDeck = new QAction(QString(), this);
    connect(aAnalyzeDeck, SIGNAL(triggered()), this, SLOT(actAnalyzeDeck()));
    aClose = new QAction(QString(), this);
    connect(aClose, SIGNAL(triggered()), this, SLOT(closeRequest()));
    aOpenCustomFolder = new QAction(QString(), this);
    connect(aOpenCustomFolder, SIGNAL(triggered()), this, SLOT(actOpenCustomFolder()));

    aEditSets = new QAction(QString(), this);
    connect(aEditSets, SIGNAL(triggered()), this, SLOT(actEditSets()));
    aEditTokens = new QAction(QString(), this);
    connect(aEditTokens, SIGNAL(triggered()), this, SLOT(actEditTokens()));

    deckMenu = new QMenu(this);
    deckMenu->addAction(aNewDeck);
    deckMenu->addAction(aLoadDeck);
    deckMenu->addAction(aSaveDeck);
    deckMenu->addAction(aSaveDeckAs);
    deckMenu->addSeparator();
    deckMenu->addAction(aLoadDeckFromClipboard);
    deckMenu->addAction(aSaveDeckToClipboard);
    deckMenu->addSeparator();
    deckMenu->addAction(aPrintDeck);
    deckMenu->addSeparator();
    deckMenu->addAction(aAnalyzeDeck);
    deckMenu->addSeparator();
    deckMenu->addAction(aClose);
    addTabMenu(deckMenu);

    dbMenu = new QMenu(this);
    dbMenu->addAction(aEditSets);
    dbMenu->addAction(aEditTokens);
    dbMenu->addSeparator();
    dbMenu->addAction(aClearFilterAll);
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
    dbMenu->addSeparator();
    dbMenu->addAction(aOpenCustomFolder);
#endif
    addTabMenu(dbMenu);

    aAddCard = new QAction(QString(), this);
    aAddCard->setIcon(QIcon(":/resources/arrow_right_green.svg"));
    connect(aAddCard, SIGNAL(triggered()), this, SLOT(actAddCard()));
    aAddCardToSideboard = new QAction(QString(), this);
    aAddCardToSideboard->setIcon(QIcon(":/resources/add_to_sideboard.svg"));
    connect(aAddCardToSideboard, SIGNAL(triggered()), this, SLOT(actAddCardToSideboard()));
    aRemoveCard = new QAction(QString(), this);
    aRemoveCard->setIcon(QIcon(":/resources/remove_row.svg"));
    connect(aRemoveCard, SIGNAL(triggered()), this, SLOT(actRemoveCard()));
    aIncrement = new QAction(QString(), this);
    aIncrement->setIcon(QIcon(":/resources/increment.svg"));
    connect(aIncrement, SIGNAL(triggered()), this, SLOT(actIncrement()));
    aDecrement = new QAction(QString(), this);
    aDecrement->setIcon(QIcon(":/resources/decrement.svg"));
    connect(aDecrement, SIGNAL(triggered()), this, SLOT(actDecrement()));

    deckEditToolBar->addAction(aAddCard);
    deckEditToolBar->addAction(aAddCardToSideboard);
    deckEditToolBar->addAction(aRemoveCard);
    deckEditToolBar->addAction(aDecrement);
    deckEditToolBar->addAction(aIncrement);
    deckEditToolBar->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);

    retranslateUi();
    
    resize(950, 700);

    QTimer::singleShot(0, this, SLOT(checkFirstRunDetected()));
}
Exemplo n.º 26
0
void TabDeckEditor::createCentralFrame()
{
    searchEdit = new SearchLineEdit;
    searchEdit->setObjectName("searchEdit");
#if QT_VERSION >= 0x050300
    searchEdit->addAction(QPixmap("theme:icons/search"), QLineEdit::LeadingPosition);
#endif

    setFocusProxy(searchEdit);
    setFocusPolicy(Qt::ClickFocus);

    searchEdit->installEventFilter(&searchKeySignals);
    searchKeySignals.setObjectName("searchKeySignals");
    connect(searchEdit, SIGNAL(textChanged(const QString &)), this, SLOT(updateSearch(const QString &)));
    connect(&searchKeySignals, SIGNAL(onEnter()), this, SLOT(actAddCard()));
    connect(&searchKeySignals, SIGNAL(onCtrlAltEqual()), this, SLOT(actAddCard()));
    connect(&searchKeySignals, SIGNAL(onCtrlAltRBracket()), this, SLOT(actAddCardToSideboard()));
    connect(&searchKeySignals, SIGNAL(onCtrlAltMinus()), this, SLOT(actDecrementCard()));
    connect(&searchKeySignals, SIGNAL(onCtrlAltLBracket()), this, SLOT(actDecrementCardFromSideboard()));
    connect(&searchKeySignals, SIGNAL(onCtrlAltEnter()), this, SLOT(actAddCardToSideboard()));
    connect(&searchKeySignals, SIGNAL(onCtrlEnter()), this, SLOT(actAddCardToSideboard()));    

    databaseModel = new CardDatabaseModel(db, this);
    databaseModel->setObjectName("databaseModel");
    databaseDisplayModel = new CardDatabaseDisplayModel(this);
    databaseDisplayModel->setSourceModel(databaseModel);
    databaseDisplayModel->setFilterKeyColumn(0);
    databaseDisplayModel->sort(0, Qt::AscendingOrder);

    databaseView = new QTreeView();
    databaseView->setObjectName("databaseView");
    databaseView->setFocusProxy(searchEdit);
    databaseView->setModel(databaseDisplayModel);
    databaseView->setUniformRowHeights(true);
    databaseView->setRootIsDecorated(false);
    databaseView->setAlternatingRowColors(true);
    databaseView->setSortingEnabled(true);
    databaseView->sortByColumn(0, Qt::AscendingOrder);
    databaseView->resizeColumnToContents(0);
    connect(databaseView->selectionModel(), SIGNAL(currentRowChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(updateCardInfoLeft(const QModelIndex &, const QModelIndex &)));
    connect(databaseView, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(actAddCard()));
    searchEdit->setTreeView(databaseView);

    aAddCard = new QAction(QString(), this);
    aAddCard->setIcon(QPixmap("theme:icons/arrow_right_green"));
    connect(aAddCard, SIGNAL(triggered()), this, SLOT(actAddCard()));
    aAddCardToSideboard = new QAction(QString(), this);
    aAddCardToSideboard->setIcon(QPixmap("theme:icons/arrow_right_blue"));
    connect(aAddCardToSideboard, SIGNAL(triggered()), this, SLOT(actAddCardToSideboard()));
    aRemoveCard = new QAction(QString(), this);
    aRemoveCard->setIcon(QPixmap("theme:icons/remove_row"));
    connect(aRemoveCard, SIGNAL(triggered()), this, SLOT(actRemoveCard()));
    aIncrement = new QAction(QString(), this);
    aIncrement->setIcon(QPixmap("theme:icons/increment"));
    connect(aIncrement, SIGNAL(triggered()), this, SLOT(actIncrement()));
    aDecrement = new QAction(QString(), this);
    aDecrement->setIcon(QPixmap("theme:icons/decrement"));
    connect(aDecrement, SIGNAL(triggered()), this, SLOT(actDecrement()));

    QToolBar *deckEditToolBar = new QToolBar;
    deckEditToolBar->setObjectName("deckEditToolBar");
    deckEditToolBar->setOrientation(Qt::Horizontal);
    deckEditToolBar->setIconSize(QSize(24, 24));

    deckEditToolBar->addAction(aAddCard);
    deckEditToolBar->addAction(aAddCardToSideboard);
    deckEditToolBar->addAction(aRemoveCard);
    deckEditToolBar->addAction(aDecrement);
    deckEditToolBar->addAction(aIncrement);
    deckEditToolBar->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);

    searchLayout = new QHBoxLayout;
    searchLayout->setObjectName("searchLayout");
    searchLayout->addWidget(deckEditToolBar);
    searchLayout->addWidget(searchEdit);
    createShowHideDocksButtons();

    centralFrame = new QVBoxLayout;
    centralFrame->setObjectName("centralFrame");
    centralFrame->addLayout(searchLayout);
    centralFrame->addWidget(databaseView);

    centralWidget = new QWidget(MainWindow);
    centralWidget->setObjectName("centralWidget");
    centralWidget->setLayout(centralFrame);
    MainWindow->setCentralWidget(centralWidget);
    MainWindow->setDockOptions(QMainWindow::AnimatedDocks|QMainWindow::AllowNestedDocks|QMainWindow::AllowTabbedDocks);

    QHBoxLayout *mainLayout = new QHBoxLayout;
    mainLayout->setObjectName("mainLayout");
    mainLayout->addWidget(MainWindow);
    setLayout(mainLayout);
}
Exemplo n.º 27
0
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);


    _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 XLineEdit(this, "_email");
    _webaddrLit		= new QLabel(tr("Web:"), this);
    _webaddrLit->setObjectName("_webaddrLit");
    _webaddr		= new XLineEdit(this, "_webaddr");
    _address		= new AddressCluster(this, "_address");

#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);
    _email->setPalette(p);
    _webaddr->setPalette(p);
    
    QFont newFont = _email->font();
    newFont.setUnderline(TRUE);
    _email->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(_email,	SIGNAL(lostFocus()), this, SLOT(sCheck()));
    connect(_webaddr,	SIGNAL(lostFocus()), this, SLOT(sCheck()));
    connect(_address,	SIGNAL(changed()),   this, SLOT(sCheck()));
    
    connect(_email,     SIGNAL(doubleClicked()), this, SLOT(sLaunchEmail()));
    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;
}
Exemplo n.º 28
0
// id is an old ident in case of an import
SeqDiagramWindow::SeqDiagramWindow(const QString & s, BrowserSeqDiagram * b, int id)
    : DiagramWindow(b, s), view(0)
{
    Q3ToolBar * toolbar = new Q3ToolBar(this, "sequence diagram operations");
    addToolBar(toolbar, TR("Toolbar"), Qt::DockTop, TRUE);

    add_edit_button(toolbar);

    select =
        new QToolButton(*selectButton, TR("Select"), QString(),
                        this, SLOT(hit_select()), toolbar,
                        "select");
    select->setToggleButton(TRUE);
    select->setOn(TRUE);
    current_button = UmlSelect;

    addFragment
        = new QToolButton(*fragmentButton, TR("Add Fragment"), QString(),
                          this, SLOT(hit_fragment()), toolbar,
                          "add fragment");
    addFragment->setToggleButton(TRUE);
    Q3WhatsThis::add(addFragment, addfragmentText());

    addClassInstance
        = new QToolButton(*classinstanceButton, TR("Add modeled Class instance"), QString(),
                          this, SLOT(hit_classinstance()), toolbar,
                          "add modeled class instance");
    addClassInstance->setToggleButton(TRUE);
    Q3WhatsThis::add(addClassInstance, addmodeledclassinstanceText());

    addClass
        = new QToolButton(*classButton, TR("Add Class instance"), QString(),
                          this, SLOT(hit_class()), toolbar,
                          "add class");
    addClass->setToggleButton(TRUE);
    Q3WhatsThis::add(addClass, addclassinstanceText());

    addContinuation
        = new QToolButton(*continuationButton, TR("Add Continuation"), QString(),
                          this, SLOT(hit_continuation()), toolbar,
                          "add continuation");
    addContinuation->setToggleButton(TRUE);
    Q3WhatsThis::add(addContinuation, addcontinuationText());

    syncMsg =
        new QToolButton(*syncmsgButton, TR("Synchronous message"), QString(),
                        this, SLOT(hit_syncmsg()), toolbar,
                        "synchronous message");
    syncMsg->setToggleButton(TRUE);
    Q3WhatsThis::add(syncMsg, syncmsgText());

    asyncMsg =
        new QToolButton(*directionalAssociationButton, TR("Asynchronous message"), QString(),
                        this, SLOT(hit_asyncmsg()), toolbar,
                        "asynchronous message");
    asyncMsg->setToggleButton(TRUE);
    Q3WhatsThis::add(asyncMsg, asyncmsgText());

    syncSelfMsg =
        new QToolButton(*syncselfmsgButton, TR("Synchronous Reflexive message"), QString(),
                        this, SLOT(hit_syncselfmsg()), toolbar,
                        "synchronous reflexive message");
    syncSelfMsg->setToggleButton(TRUE);
    Q3WhatsThis::add(syncSelfMsg, syncselfmsgText());

    asyncSelfMsg =
        new QToolButton(*asyncselfmsgButton, TR("Asynchronous Reflexive message"), QString(),
                        this, SLOT(hit_asyncselfmsg()), toolbar,
                        "asynchronous reflexive message");
    asyncSelfMsg->setToggleButton(TRUE);
    Q3WhatsThis::add(asyncSelfMsg, asyncselfmsgText());

    foundsyncMsg =
        new QToolButton(*foundsyncmsgButton, TR("Synchronous found message"), QString(),
                        this, SLOT(hit_foundsyncmsg()), toolbar,
                        "synchronous found message");
    foundsyncMsg->setToggleButton(TRUE);
    Q3WhatsThis::add(foundsyncMsg, foundsyncmsgText());

    foundasyncMsg =
        new QToolButton(*foundasyncmsgButton, TR("Asynchronous found message"), QString(),
                        this, SLOT(hit_foundasyncmsg()), toolbar,
                        "asynchronous found message");
    foundasyncMsg->setToggleButton(TRUE);
    Q3WhatsThis::add(foundasyncMsg, foundasyncmsgText());

    lostsyncMsg =
        new QToolButton(*lostsyncmsgButton, TR("Synchronous lost message"), QString(),
                        this, SLOT(hit_lostsyncmsg()), toolbar,
                        "synchronous lost message");
    lostsyncMsg->setToggleButton(TRUE);
    Q3WhatsThis::add(lostsyncMsg, lostsyncmsgText());

    lostasyncMsg =
        new QToolButton(*lostasyncmsgButton, TR("Asynchronous lost message"), QString(),
                        this, SLOT(hit_lostasyncmsg()), toolbar,
                        "asynchronous lost message");
    lostasyncMsg->setToggleButton(TRUE);
    Q3WhatsThis::add(lostasyncMsg, lostasyncmsgText());

    returnMsg =
        new QToolButton(*returnmsgButton, TR("Explicit return"), QString(),
                        this, SLOT(hit_returnmsg()), toolbar,
                        "explicit return");
    returnMsg->setToggleButton(TRUE);
    Q3WhatsThis::add(returnMsg, returnmsgText());

    selfreturnMsg =
        new QToolButton(*selfreturnmsgButton, TR("Explicit reflexive return"), QString(),
                        this, SLOT(hit_selfreturnmsg()), toolbar,
                        "explicit reflexive return");
    selfreturnMsg->setToggleButton(TRUE);
    Q3WhatsThis::add(selfreturnMsg,  selfreturnmsgText());

    note =
        new QToolButton(*noteButton, TR("Note"), QString(),
                        this, SLOT(hit_note()), toolbar,
                        "note");
    note->setToggleButton(TRUE);
    Q3WhatsThis::add(note, noteText());

    anchor =
        new QToolButton(*anchorButton, TR("Anchor"), QString(),
                        this, SLOT(hit_anchor()), toolbar,
                        "anchor");
    anchor->setToggleButton(TRUE);
    Q3WhatsThis::add(anchor, anchorText());

    text =
        new QToolButton(*textButton, TR("Text"), QString(),
                        this, SLOT(hit_text()), toolbar,
                        "text");
    text->setToggleButton(TRUE);
    Q3WhatsThis::add(text, textText());

    image =
        new QToolButton(*imageButton, TR("Image"), QString(),
                        this, SLOT(hit_image()), toolbar, "image");
    image->setToggleButton(TRUE);
    Q3WhatsThis::add(image, imageText());

    toolbar->addSeparator();

    add_scale_cmd(toolbar);

    //

    view = new SeqDiagramView(this, canvas, (id != -1) ? id : b->get_ident());
    setFocusProxy(view);
    setCentralWidget(view);

    //qApp->setMainWidget(this);

    QWorkspace * w = UmlWindow::get_workspace();

    resize((w->width() * 4) / 5, (w->height() * 4) / 5);

    /*if (w->windowList().isEmpty())
      showMaximized();
    else*/
    show();

    view->preferred_size_zoom();

    //qApp->setMainWidget(0);
}
Exemplo n.º 29
0
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);

    //_numberBox          = new QHBoxLayout;
    //_numberBox->setSpacing(2);
    _nameBox		= new QHBoxLayout;
    _nameBox->setSpacing(2);
    _titleBox		= new QHBoxLayout;
    _titleBox->setSpacing(2);

    _numberLit		= new QLabel(tr("Number:"), this, "_numberLit");
    _number		= new QLineEdit(this, "_number");
  
    //_numberBox->addWidget(_numberLit,	0);
    //_numberBox->addWidget(_number,	0);
    
    _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);
}
Exemplo n.º 30
0
KexiRelationsView::KexiRelationsView(QWidget *parent)
        : KexiView(parent)
        , d(new Private)
{
    QWidget *mainWidget = new QWidget(this);
    QGridLayout *g = new QGridLayout(mainWidget);
    g->setContentsMargins(0, 0, 0, 0);
    g->setSpacing(KexiUtils::spacingHint());

    QWidget *horWidget = new QWidget(mainWidget);
    QHBoxLayout *hlyr = new QHBoxLayout(horWidget);
    hlyr->setContentsMargins(0, 0, 0, 0);
    g->addWidget(horWidget, 0, 0);

    d->tableCombo = new KComboBox(horWidget);
    d->tableCombo->setObjectName("tables_combo");
    d->tableCombo->setMinimumWidth(QFontMetrics(font()).width("w")*20);
    d->tableCombo->setInsertPolicy(QComboBox::NoInsert);
    d->tableCombo->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred));
    QLabel *lbl = new QLabel(xi18n("Table:"), horWidget);
    lbl->setBuddy(d->tableCombo);
    lbl->setIndent(3);
    hlyr->addWidget(lbl);
    hlyr->addWidget(d->tableCombo);

    d->btnAdd = new QPushButton(xi18nc("Insert table/query into relations view", "&Insert"), horWidget);
    hlyr->addWidget(d->btnAdd);
    hlyr->addStretch(1);
    connect(d->btnAdd, SIGNAL(clicked()), this, SLOT(slotAddTable()));

    d->scrollArea = new KexiRelationsScrollArea(mainWidget);
    d->scrollArea->setObjectName("scroll_area");
    setViewWidget(mainWidget, false/* no focus proxy */);
    setFocusProxy(d->scrollArea);
    g->addWidget(d->scrollArea, 1, 0);

    //actions
    d->tableQueryPopup = new QMenu(this);
    d->tableQueryPopup->setObjectName("tableQueryPopup");
    connect(d->tableQueryPopup, SIGNAL(aboutToShow()), this, SLOT(aboutToShowPopupMenu()));

    d->hideTableAction = plugSharedAction("edit_delete", xi18n("&Hide Table"), d->tableQueryPopup);
    if (d->hideTableAction)
        d->hideTableAction->setIcon(QIcon());

    d->connectionPopup = new QMenu(this);
    d->connectionPopup->setObjectName("connectionPopup");
    connect(d->connectionPopup, SIGNAL(aboutToShow()), this, SLOT(aboutToShowPopupMenu()));

//! @todo areaPopup
    d->areaPopup = new QMenu(this);
    d->areaPopup->setObjectName("areaPopup");

    d->appendSelectedFieldAction = new QAction(koIcon("add_field"), xi18n("&Append Field"), this);
    d->appendSelectedFieldAction->setObjectName("relationsview_appendField");
    connect(d->appendSelectedFieldAction, SIGNAL(triggered()),
            this, SLOT(appendSelectedFields()));

    d->appendSelectedFieldsAction = new QAction(koIcon("add_field"), xi18n("&Append Fields"), this);
    d->appendSelectedFieldsAction->setObjectName("relationsview_appendFields");
    connect(d->appendSelectedFieldsAction, SIGNAL(triggered()),
            this, SLOT(appendSelectedFields()));

    d->openSelectedTableAction = new QAction(koIcon("document-open"), xi18n("&Open Table"), this);
    d->openSelectedTableAction->setObjectName("relationsview_openTable");
    connect(d->openSelectedTableAction, SIGNAL(triggered()),
            this, SLOT(openSelectedTable()));

    d->designSelectedTableAction = new QAction(koIcon("document-properties"), xi18n("&Design Table"), this);
    connect(d->designSelectedTableAction, SIGNAL(triggered()),
            this, SLOT(designSelectedTable()));
    d->designSelectedTableAction->setObjectName("relationsview_designTable");

    plugSharedAction("edit_delete", this, SLOT(removeSelectedObject()));

    connect(d->scrollArea, SIGNAL(tableViewGotFocus()),
            this, SLOT(tableViewGotFocus()));
    connect(d->scrollArea, SIGNAL(connectionViewGotFocus()),
            this, SLOT(connectionViewGotFocus()));
    connect(d->scrollArea, SIGNAL(emptyAreaGotFocus()),
            this, SLOT(emptyAreaGotFocus()));
    connect(d->scrollArea, SIGNAL(tableContextMenuRequest(QPoint)),
            this, SLOT(tableContextMenuRequest(QPoint)));
    connect(d->scrollArea, SIGNAL(connectionContextMenuRequest(QPoint)),
            this, SLOT(connectionContextMenuRequest(QPoint)));
    connect(d->scrollArea, SIGNAL(tableHidden(KDbTableSchema*)),
            this, SLOT(slotTableHidden(KDbTableSchema*)));
    connect(d->scrollArea, SIGNAL(tablePositionChanged(KexiRelationsTableContainer*)),
            this, SIGNAL(tablePositionChanged(KexiRelationsTableContainer*)));
    connect(d->scrollArea, SIGNAL(aboutConnectionRemove(KexiRelationsConnection*)),
            this, SIGNAL(aboutConnectionRemove(KexiRelationsConnection*)));

    //! @todo
#if 0
    if (!embedd) {
        /*todo  setContextHelp(xi18n("Relations"), xi18n("To create a relationship simply drag the source field onto the target field. "
              "An arrowhead is used to show which table is the parent (master) and which table is the child (slave) in the relationship."));*/
    }
#endif

#ifdef TESTING_KexiRelationWidget
    for (int i = 0;i < (int)d->db->tableNames().count();i++)
        QTimer::singleShot(100, this, SLOT(slotAddTable()));
#endif

    invalidateActions();
}