当前位置: 首页>>代码示例>>C++>>正文


C++ setFocusProxy函数代码示例

本文整理汇总了C++中setFocusProxy函数的典型用法代码示例。如果您正苦于以下问题:C++ setFocusProxy函数的具体用法?C++ setFocusProxy怎么用?C++ setFocusProxy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了setFocusProxy函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: QScriptDebuggerCodeFinderWidgetInterface

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()));
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:71,代码来源:qscriptdebuggercodefinderwidget.cpp

示例2: QWidget

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);
}
开发者ID:ChristopherCotnoir,项目名称:qt-client,代码行数:80,代码来源:comments.cpp

示例3: setFocusProxy

// Destroy a call tip.
QsciSciCallTip::~QsciSciCallTip()
{
    // Ensure that the main window doesn't receive a focus out event when
    // this is destroyed.
    setFocusProxy(0);
}
开发者ID:4sp1r3,项目名称:sqlitebrowser,代码行数:7,代码来源:SciClasses.cpp

示例4: QGroupBox

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" ) );
//.........这里部分代码省略.........
开发者ID:kuzavas,项目名称:qtiplot,代码行数:101,代码来源:EnrichmentDialog.cpp

示例5: QDialog


//.........这里部分代码省略.........
	
	//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);
};
开发者ID:Pataua,项目名称:rpcs3,代码行数:101,代码来源:rsx_debugger.cpp

示例6: QDialog


//.........这里部分代码省略.........
  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;
}
开发者ID:liyulun,项目名称:mantid,代码行数:101,代码来源:FunctionDialog.cpp

示例7: QHBoxLayout

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;
}
开发者ID:dmitry-aka-jok,项目名称:jpos2,代码行数:69,代码来源:login.cpp

示例8: QWidget

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();
}
开发者ID:invalid404,项目名称:trojita,代码行数:64,代码来源:FindBar.cpp

示例9: QWidget

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();
}
开发者ID:betsegaw,项目名称:bibletime,代码行数:96,代码来源:btbiblekeywidget.cpp

示例10: QPushButton


//.........这里部分代码省略.........
    _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;
}
开发者ID:dwatson78,项目名称:qt-client,代码行数:101,代码来源:addressCluster.cpp

示例11: resize


//.........这里部分代码省略.........
    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 );
}
开发者ID:Alphax,项目名称:nifskope,代码行数:101,代码来源:valueedit.cpp

示例12: QwtPlot

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);
}
开发者ID:BackupTheBerlios,项目名称:qtiplot-svn,代码行数:63,代码来源:plot.cpp

示例13: QWidget

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
}
开发者ID:KDE,项目名称:rekonq,代码行数:74,代码来源:webtab.cpp

示例14: Tab

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);
//.........这里部分代码省略.........
开发者ID:Wettoiletpaper,项目名称:Cockatrice,代码行数:101,代码来源:tab_deck_editor.cpp

示例15: setFocusProxy

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);
}
开发者ID:JFLEKY,项目名称:Cockatrice,代码行数:93,代码来源:tab_deck_editor.cpp


注:本文中的setFocusProxy函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。