Ejemplo n.º 1
0
void LocationBar::updatePlaceHolderText()
{
    if (qzSettings->searchFromAddressBar) {
        setPlaceholderText(tr("Enter address or search with %1").arg(searchEngine().name));
    } else
        setPlaceholderText(tr("Enter address"));
}
Ejemplo n.º 2
0
void LocationBar::updatePlaceHolderText()
{
    if (qzSettings->searchFromAddressBar) {
        QString engineName = qzSettings->searchWithDefaultEngine ?
                             mApp->searchEnginesManager()->defaultEngine().name :
                             mApp->searchEnginesManager()->activeEngine().name;
        setPlaceholderText(tr("Enter URL address or search on %1").arg(engineName));
    } else
        setPlaceholderText(tr("Enter URL address"));
}
Ejemplo n.º 3
0
PlaceEdit::PlaceEdit(PlaceEdit *_parent, int _index, QString placeholderText, QWidget *qparent)
  : QLineEdit(qparent)
{
  qDebug() << "creating place edit";

  setMaxLength(40);

  setPlaceholderText(placeholderText);

  m_model = new PlaceModel(_index, this);
  m_completer = new QCompleter(m_model, this);
  m_completer->setCaseSensitivity(Qt::CaseInsensitive);

  // TODO put in mask
  // TODO prevent slashes

  m_completer->setModel(m_model);
  setCompleter(m_completer);

  setValidator(new LineValidator(this));

  if (_parent) {
    connect(_parent->model(), SIGNAL(valueChanged(QString)), m_model, SLOT(onParentTextChanged(QString)));
    connect(_parent->model(), SIGNAL(valueChanged(QString)), this, SLOT(onParentTextChanged(QString)));
  }
}
Ejemplo n.º 4
0
AddressWidget::AddressWidget(Window *window, QWidget *parent) : QLineEdit(parent),
	m_window(NULL),
	m_completer(new QCompleter(AddressCompletionModel::getInstance(), this)),
	m_bookmarkLabel(NULL),
	m_feedsLabel(NULL),
	m_loadPluginsLabel(NULL),
	m_urlIconLabel(NULL),
	m_simpleMode(false)
{
	m_completer->setCaseSensitivity(Qt::CaseInsensitive);
	m_completer->setCompletionMode(QCompleter::InlineCompletion);
	m_completer->setCompletionRole(Qt::DisplayRole);
	m_completer->setFilterMode(Qt::MatchStartsWith);

	setWindow(window);
	setCompleter(m_completer);
	setMinimumWidth(100);

	ToolBarWidget *toolBar = qobject_cast<ToolBarWidget*>(parent);

	if (toolBar)
	{
		optionChanged(QLatin1String("AddressField/ShowBookmarkIcon"), SettingsManager::getValue(QLatin1String("AddressField/ShowBookmarkIcon")));
		optionChanged(QLatin1String("AddressField/ShowUrlIcon"), SettingsManager::getValue(QLatin1String("AddressField/ShowUrlIcon")));
		setPlaceholderText(tr("Enter address or search…"));
		setMouseTracking(true);

		connect(SettingsManager::getInstance(), SIGNAL(valueChanged(QString,QVariant)), this, SLOT(optionChanged(QString,QVariant)));
		connect(toolBar, SIGNAL(windowChanged(Window*)), this, SLOT(setWindow(Window*)));
	}
	else
	{
Ejemplo n.º 5
0
int ClickLineEdit::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QLineEdit::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    
#ifndef QT_NO_PROPERTIES
     if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< QString*>(_v) = placeholderText(); break;
        }
        _id -= 1;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setPlaceholderText(*reinterpret_cast< QString*>(_v)); break;
        }
        _id -= 1;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 1;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 1;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 1;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 1;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 1;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 1;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
Ejemplo n.º 6
0
void ResourceDock::setupHTools() {
	auto htools = new QFrame(this);
	auto vlayout = new QVBoxLayout(htools);
	vlayout->setMargin(2);
	vlayout->setSpacing(0);

	auto hlayoutTitle = new QHBoxLayout();
	auto title = new QLabel(htools);
	title->setText("Resource Explorer ");
	title->setStyleSheet("color: lightGray;");
	hlayoutTitle->addWidget(title);

	auto sepBrush = QBrush(Qt::gray, Qt::BrushStyle::Dense6Pattern);
	QPalette sepPalette;
	sepPalette.setBrush(QPalette::Background, sepBrush);

	auto seprator = new QLabel(htools);
	seprator->setAutoFillBackground(true);
	seprator->setPalette(sepPalette);
	seprator->setMaximumHeight(10);
	hlayoutTitle->addWidget(seprator, 1, Qt::AlignBottom);

	auto btnClose = new QToolButton(htools);
	btnClose->setText("X");
	btnClose->setStyleSheet("color: lightGray\n");
	btnClose->setAutoRaise(true);
	btnClose->setMaximumWidth(16);
	btnClose->setMaximumHeight(16);
	hlayoutTitle->addWidget(btnClose);
	connect(btnClose, &QToolButton::clicked, this, &QDockWidget::hide);

	vlayout->addLayout(hlayoutTitle);
	vlayout->addSpacing(2);

	auto hlayoutTools = new QHBoxLayout();
	hlayoutTools->setMargin(0);
	hlayoutTools->setSpacing(0);

	auto btnCollAll = new QToolButton(htools);
	btnCollAll->setIcon(QIcon(":/icons/col"));
	btnCollAll->setToolTip("Collapse All");
	btnCollAll->setToolButtonStyle(Qt::ToolButtonIconOnly);
	connect(btnCollAll, &QToolButton::clicked, resTree, &QTreeWidget::collapseAll);
	hlayoutTools->addWidget(btnCollAll);
	hlayoutTools->addSpacing(5);

	auto ledit = new QLineEdit(htools);
	ledit->setPlaceholderText("Search");
	ledit->addAction(QIcon(":/icons/search"), QLineEdit::ActionPosition::TrailingPosition);
	ledit->setStyleSheet("background-color: gray;");
	connect(ledit, &QLineEdit::textChanged, this, &ResourceDock::searchAct);
	hlayoutTools->addWidget(ledit, 1);
	vlayout->addLayout(hlayoutTools);

	htools->setLayout(vlayout);

	setTitleBarWidget(htools);
}
Ejemplo n.º 7
0
void WebSearchBar::focusOutEvent(QFocusEvent* e)
{
    if (text().isEmpty()) {
        QString search = m_boxSearchType->currentItem().text;
        setPlaceholderText(search);
    }

    LineEdit::focusOutEvent(e);
}
NewTagAction::NewTagAction(KoResource* resource, QMenu* parent)
    :KoLineEditAction (parent)
{
    m_resource = resource;
    setIcon(koIcon("document-new"));
    setPlaceholderText(i18n("New tag"));
    closeParentOnTrigger(true);

    connect (this, SIGNAL(triggered(QString)),
             this, SLOT(onTriggered(QString)));
}
FilterLineEdit::FilterLineEdit(QWidget *parent) :
   FancyLineEdit(parent),
   m_lastFilterText(text())
{
    setSide(Utils::FancyLineEdit::Right);
    setPlaceholderText(tr("Filter"));
    setButtonToolTip(tr("Clear text"));
    setAutoHideIcon(true);
    connect(this, SIGNAL(buttonClicked()), this, SLOT(clear()));
    connect(this, SIGNAL(textChanged(QString)), this, SLOT(slotTextChanged()));
}
Ejemplo n.º 10
0
LineEdit::LineEdit(QWidget *parent, GraphicsScene* tscene)
    //: QLabel(parent)
    : QLineEdit(parent)
    , scene(tscene)
      //, m_idx(idx)
{
    setPlaceholderText("A[Enter text here]");
    setReadOnly(true);
    //connect(this, SIGNAL(selectTextSignal(int)), parentWidget(), SLOT(selectedText()));
    //connect(this, SIGNAL(selectTextSignal()), parentWidget(), SLOT(selectedText()));
}
Ejemplo n.º 11
0
    SearchEdit(QWidget *parent = 0)
        : Utils::FancyLineEdit(parent)
    {
        QIcon icon = QIcon::fromTheme(layoutDirection() == Qt::LeftToRight ?
                         QLatin1String("edit-clear-locationbar-rtl") :
                         QLatin1String("edit-clear-locationbar-ltr"),
                         QIcon::fromTheme(QLatin1String("edit-clear"), QIcon(QLatin1String("icon:images/editclear.png"))));

        setButtonPixmap(Right, icon.pixmap(16));
        setPlaceholderText(tr("Search"));
        setButtonToolTip(Right, tr("Stop Search"));
    }
Ejemplo n.º 12
0
    /* 构造函数实现 */
    _NoteTitleLineEdit::_NoteTitleLineEdit(QWidget *_Parent)
        : QLineEdit(_Parent)
        {
        m_FontFamily = "微软雅黑,12,-1,5,50,0,0,0,0,0";

        setStyleSheet("color:darkGray");
        setFont(QFont(m_FontFamily, 15, 15, true));
        setCursorMoveStyle(Qt::LogicalMoveStyle);
        setFrame(false);
        setPlaceholderText(tr("在此设置标题..."));

        connect(this, SIGNAL(textChanged(QString)),
                this, SLOT(_CurrentTextChanged(QString)));
        }
Ejemplo n.º 13
0
void CaptureFilterEdit::setConflict(bool conflict)
{
    if (conflict) {
        //: This is a very long concept that needs to fit into a short space.
        placeholder_text_ = tr("Multiple filters selected. Override them here or leave this blank to preserve them.");
        setToolTip(tr("<p>The interfaces you have selected have different capture filters."
                      " Typing a filter here will override them. Doing nothing will"
                      " preserve them.</p>"));
    } else {
        placeholder_text_ = QString(tr("Enter a capture filter %1")).arg(UTF8_HORIZONTAL_ELLIPSIS);
        setToolTip(QString());
    }
    setPlaceholderText(placeholder_text_);
}
Ejemplo n.º 14
0
void WebSearchBar::searchChanged(const ButtonWithMenu::Item &item)
{
    setPlaceholderText(item.text);
    m_completerModel->setStringList(QStringList());

    m_activeEngine = item.userData.value<SearchEngine>();

    m_openSearchEngine->setSuggestionsUrl(m_activeEngine.suggestionsUrl);
    m_openSearchEngine->setSuggestionsParameters(m_activeEngine.suggestionsParameters);

    m_searchManager->setActiveEngine(m_activeEngine);

    if (qzSettings->searchOnEngineChange && !m_reloadingEngines && !text().isEmpty()) {
        search();
    }
}
Ejemplo n.º 15
0
QWidget *LineEditAction::createWidget(QWidget *parent)
{
    auto lineEdit = new QLineEdit(parent);

    lineEdit->setPlaceholderText(m_placeHolderText);
    lineEdit->setFixedWidth(100);
    QFont font = lineEdit->font();
    font.setPixelSize(Theme::instance()->smallFontPixelSize());
    lineEdit->setFont(font);
    lineEdit->setValidator(new QIntValidator(0, 4096, this));

    connect(lineEdit, &QLineEdit::textEdited, this, &LineEditAction::textChanged);
    connect(this, &LineEditAction::lineEditTextClear, lineEdit, &QLineEdit::clear);
    connect(this, &LineEditAction::lineEditTextChange, lineEdit, &QLineEdit::setText);

    return lineEdit;
}
InputTextWidget::InputTextWidget(QWidget* parent) :
    QTextEdit(parent)
{
    setMinimumSize(10, 50);

    setPlaceholderText(tr("Type your text here..."));

    setContextMenuPolicy(Qt::CustomContextMenu);
    connect(this, &InputTextWidget::customContextMenuRequested, this, &InputTextWidget::showContextMenu);

    actionUndo  = new QAction(QIcon(":/icons/arrow_undo.png"), tr("Undo"), this);
    actionRedo  = new QAction(QIcon(":/icons/arrow_redo.png"), tr("Redo"), this);
    actionCut   = new QAction(QIcon(":/icons/cut.png"), tr("Cut"), this);
    actionCopy  = new QAction(QIcon(":/icons/page_copy.png"), tr("Copy"), this);
    actionPaste = new QAction(QIcon(":/icons/paste_plain.png"), tr("Paste"), this);

    actionUndo->setShortcut(QKeySequence::Undo);
    actionRedo->setShortcut(QKeySequence::Redo);
    actionCut->setShortcut(QKeySequence::Cut);
    actionCopy->setShortcut(QKeySequence::Copy);
    actionPaste->setShortcut(QKeySequence::Paste);

    actionUndo->setEnabled(false);
    actionRedo->setEnabled(false);
    actionCut->setEnabled(false);
    actionCopy->setEnabled(false);
    actionPaste->setEnabled(!QApplication::clipboard()->text().isEmpty());

    connect(actionUndo,  &QAction::triggered, this, &InputTextWidget::undo);
    connect(actionRedo,  &QAction::triggered, this, &InputTextWidget::redo);
    connect(actionCut,   &QAction::triggered, this, &InputTextWidget::cutPlainText);
    connect(actionCopy,  &QAction::triggered, this, &InputTextWidget::copyPlainText);
    connect(actionPaste, &QAction::triggered, this, &InputTextWidget::pastePlainText);

    connect(this, &InputTextWidget::undoAvailable, [this](bool enabled) {
        actionUndo->setEnabled(enabled);
    });
    connect(this, &InputTextWidget::redoAvailable, [this](bool enabled) {
        actionRedo->setEnabled(enabled);
    });
    connect(this, &InputTextWidget::copyAvailable, [this](bool enabled) {
        actionCut->setEnabled(enabled);
        actionCopy->setEnabled(enabled);
    });
}
Ejemplo n.º 17
0
PlaceEdit::PlaceEdit(PlaceEdit *_parent, int _index, 
		     QString placeholder_text, QWidget *qparent) :
  QLineEdit(qparent) {
  qDebug() << "creating place edit";
  setMaxLength (40);
  
  setPlaceholderText (placeholder_text);

  model = new PlaceModel (_index, this);
  completer = new QCompleter (model, this);
  completer->setCaseSensitivity (Qt::CaseInsensitive);

  // TODO put in mask
  // TODO prevent slashes

  completer->setModel (model);
  setCompleter (completer);

  setValidator (new LineValidator (this));

  /*
    // delay or otherwise act as if the user hit return after 500ms

  timer = new QTimer (this);
  timer->setSingleShot(true);
  timer->setInterval(500);


  connect(timer, SIGNAL(timeout()), SLOT(handle_check_username()));

  connect(username, SIGNAL(textEdited(QString)), username_timer, SLOT(start()));

  connect (this, SIGNAL (textChanged (QString)),
	   model, SLOT (handle_text_changed (QString)));
  */

  if (_parent != NULL) {
    connect (_parent->get_model(), SIGNAL(value_changed(QString)),
	     model, SLOT(handle_parent_text_changed(QString)));
    connect (_parent->get_model(), SIGNAL(value_changed(QString)),
	     this, SLOT(handle_parent_text_changed(QString)));
  }

}
Ejemplo n.º 18
0
SearchTextBar::SearchTextBar(QWidget* const parent, const QString& name, const QString& msg)
    : QLineEdit(parent),
      StateSavingObject(this),
      d(new Private)
{
    setAttribute(Qt::WA_DeleteOnClose);
    setClearButtonEnabled(true);
    setPlaceholderText(msg);
    setObjectName(name + QLatin1String(" Search Text Tool"));

    d->completer = new ModelCompleter(this);
    setCompleter(d->completer);

    setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));

    connect(this, SIGNAL(textChanged(QString)),
            this, SLOT(slotTextChanged(QString)));

    loadState();
}
Ejemplo n.º 19
0
FilterLineEdit::FilterLineEdit(QWidget* parent, QList<FilterLineEdit*>* filters, int columnnum) : QLineEdit(parent), filterList(filters), columnNumber(columnnum)
{
    setPlaceholderText(tr("Filter"));
    setClearButtonEnabled(true);
    setProperty("column", columnnum);            // Store the column number for later use

    // Introduce a timer for delaying the signal triggered whenever the user changes the filter value.
    // The idea here is that the textChanged() event isn't connected to the update filter slot directly anymore
    // but instead there this timer mechanism in between: whenever the user changes the filter the delay timer
    // is (re)started. As soon as the user stops typing the timer has a chance to trigger and call the
    // delayedSignalTimerTriggered() method which then stops the timer and emits the delayed signal.
    delaySignalTimer = new QTimer(this);
    delaySignalTimer->setInterval(Settings::getValue("databrowser", "filter_delay").toInt());  // This is the milliseconds of not-typing we want to wait before triggering
    connect(this, SIGNAL(textChanged(QString)), delaySignalTimer, SLOT(start()));
    connect(delaySignalTimer, SIGNAL(timeout()), this, SLOT(delayedSignalTimerTriggered()));

    // Immediately emit the delayed filter value changed signal if the user presses the enter or the return key or
    // the line edit widget loses focus
    connect(this, SIGNAL(editingFinished()), this, SLOT(delayedSignalTimerTriggered()));
}
Ejemplo n.º 20
0
FilterLineEdit::FilterLineEdit(QWidget *parent) :
   FancyLineEdit(parent),
   m_lastFilterText(text())
{
    // KDE has custom icons for this. Notice that icon namings are counter intuitive.
    // If these icons are not available we use the freedesktop standard name before
    // falling back to a bundled resource.
    QIcon icon = QIcon::fromTheme(layoutDirection() == Qt::LeftToRight ?
                     QLatin1String("edit-clear-locationbar-rtl") :
                     QLatin1String("edit-clear-locationbar-ltr"),
                     QIcon::fromTheme(QLatin1String("edit-clear"), QIcon(QLatin1String(":/core/images/editclear.png"))));

    setButtonPixmap(Right, icon.pixmap(16));
    setButtonVisible(Right, true);
    setPlaceholderText(tr("Filter"));
    setButtonToolTip(Right, tr("Clear text"));
    setAutoHideButton(Right, true);
    connect(this, SIGNAL(rightButtonClicked()), this, SLOT(clear()));
    connect(this, SIGNAL(textChanged(QString)), this, SLOT(slotTextChanged()));
}
Ejemplo n.º 21
0
void DisplayFilterEdit::setDefaultPlaceholderText()
{
    switch (type_) {

    case DisplayFilterToApply:
        placeholder_text_ = QString(tr("Apply a display filter %1 <%2/>")).arg(UTF8_HORIZONTAL_ELLIPSIS)
    .arg(DEFAULT_MODIFIER);
        break;

    case DisplayFilterToEnter:
        placeholder_text_ = QString(tr("Enter a display filter %1")).arg(UTF8_HORIZONTAL_ELLIPSIS);
        break;

    case ReadFilterToApply:
        placeholder_text_ = QString(tr("Apply a read filter %1")).arg(UTF8_HORIZONTAL_ELLIPSIS);
        break;
    }
#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
    setPlaceholderText(placeholder_text_);
#endif
}
Ejemplo n.º 22
0
TagEditor::TagEditor(QWidget* parent)
    : KTextEdit(parent)
{
    // Don't keep scroll bars
    setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
    setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );

    setContextMenuPolicy( Qt::NoContextMenu );
    setPlaceholderText( QLatin1String("Tags (comma separated)") );

    connect( document()->documentLayout(), SIGNAL(documentSizeChanged(QSizeF)),
             this, SLOT(slotDocumentSizeChanged()) );

    slotDocumentSizeChanged();

    m_completer = new TagCompleter( this );
    m_completer->setWidget( this );
    m_completer->setCompletionMode( QCompleter::PopupCompletion );

    connect( m_completer, SIGNAL(activated(QString)), this, SLOT(insertCompletion(QString)) );
}
Ejemplo n.º 23
0
FilterLineEdit::FilterLineEdit(QWidget* parent, std::vector<FilterLineEdit*>* filters, size_t columnnum) : QLineEdit(parent), filterList(filters), columnNumber(columnnum)
{
    setPlaceholderText(tr("Filter"));
    setClearButtonEnabled(true);
    setProperty("column", static_cast<int>(columnnum));            // Store the column number for later use

    // Introduce a timer for delaying the signal triggered whenever the user changes the filter value.
    // The idea here is that the textChanged() event isn't connected to the update filter slot directly anymore
    // but instead there this timer mechanism in between: whenever the user changes the filter the delay timer
    // is (re)started. As soon as the user stops typing the timer has a chance to trigger and call the
    // delayedSignalTimerTriggered() method which then stops the timer and emits the delayed signal.
    delaySignalTimer = new QTimer(this);
    delaySignalTimer->setInterval(Settings::getValue("databrowser", "filter_delay").toInt());  // This is the milliseconds of not-typing we want to wait before triggering
    connect(this, SIGNAL(textChanged(QString)), delaySignalTimer, SLOT(start()));
    connect(delaySignalTimer, SIGNAL(timeout()), this, SLOT(delayedSignalTimerTriggered()));

    setWhatsThis(tr("These input fields allow you to perform quick filters in the currently selected table.\n"
                    "By default, the rows containing the input text are filtered out.\n"
                    "The following operators are also supported:\n"
                    "%\tWildcard\n"
                    ">\tGreater than\n"
                    "<\tLess than\n"
                    ">=\tEqual to or greater\n"
                    "<=\tEqual to or less\n"
                    "=\tEqual to: exact match\n"
                    "<>\tUnequal: exact inverse match\n"
                    "x~y\tRange: values between x and y\n"
                    "/regexp/\tValues matching the regular expression"));

    // Immediately emit the delayed filter value changed signal if the user presses the enter or the return key or
    // the line edit widget loses focus
    connect(this, SIGNAL(editingFinished()), this, SLOT(delayedSignalTimerTriggered()));

    // Prepare for adding the What's This information and filter helper actions to the context menu
    setContextMenuPolicy(Qt::CustomContextMenu);
    connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(showContextMenu(const QPoint &)));
}
Ejemplo n.º 24
0
// The SearchLineEdit class is adapted from code presented by Girish
// Ramakrishnan in a Qt Labs post:
//
//   http://labs.qt.nokia.com/2007/06/06/lineedit-with-a-clear-button
SearchLineEdit::SearchLineEdit(QWidget *parent):
  QLineEdit(parent)
{
  previousResultButton = new QToolButton(this);
  previousResultButton->setIcon(style()->standardIcon(QStyle::SP_ArrowLeft));
  previousResultButton->setCursor(Qt::ArrowCursor);
  previousResultButton->setStyleSheet(QString::fromUtf8("QToolButton { border: none; padding: 0px; }"));
  connect(previousResultButton, SIGNAL(clicked()), this, SLOT(handlePreviousResult()));

  nextResultButton = new QToolButton(this);
  nextResultButton->setIcon(style()->standardIcon(QStyle::SP_ArrowRight));
  nextResultButton->setCursor(Qt::ArrowCursor);
  nextResultButton->setStyleSheet(QString::fromUtf8("QToolButton { border: none; padding: 0px; }"));
  connect(nextResultButton, SIGNAL(clicked()), this, SLOT(handleNextResult()));

  clearButton = new QToolButton(this);
  clearButton->setIcon(style()->standardIcon(QStyle::SP_TitleBarCloseButton));
  clearButton->setCursor(Qt::ArrowCursor);
  clearButton->setStyleSheet(QString::fromUtf8("QToolButton { border: none; padding: 0px; }"));
  connect(clearButton, SIGNAL(clicked()), this, SLOT(clearSearch()));

  int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
  setStyleSheet(QString::fromUtf8("QLineEdit { padding-right: %1px; } ").arg(
      nextResultButton->sizeHint().width() +
      previousResultButton->sizeHint().width() +
      clearButton->sizeHint().width() + frameWidth + 1));
  QSize msz = minimumSizeHint();
  setMinimumSize(qMax(msz.width(), nextResultButton->sizeHint().width() +
      previousResultButton->sizeHint().width() +
      clearButton->sizeHint().width() + frameWidth * 2 + 2),
      qMax(msz.height(), clearButton->sizeHint().height() + frameWidth * 2 + 2));

  connect(this, SIGNAL(returnPressed()), this, SLOT(prepareSearch()));

  setPlaceholderText(QString::fromUtf8("Search"));
}
Ejemplo n.º 25
0
ClickLineEdit::ClickLineEdit( const QString &msg, QWidget *parent) : QLineEdit( parent )
{
    mDrawClickMsg = true;
    setPlaceholderText( msg );
}
Ejemplo n.º 26
0
CaptureFilterEdit::CaptureFilterEdit(QWidget *parent, bool plain) :
    SyntaxLineEdit(parent),
    plain_(plain),
    field_name_only_(false),
    bookmark_button_(NULL),
    clear_button_(NULL),
    apply_button_(NULL)
{
    setAccessibleName(tr("Capture filter entry"));

    completion_model_ = new QStringListModel(this);
    setCompleter(new QCompleter(completion_model_, this));
    setCompletionTokenChars(libpcap_primitive_chars_);

    placeholder_text_ = QString(tr("Enter a capture filter %1")).arg(UTF8_HORIZONTAL_ELLIPSIS);
#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
    setPlaceholderText(placeholder_text_);
#endif

    // These are fully implemented in DisplayFilterEdit but not here.

    if (!plain_) {
        bookmark_button_ = new StockIconToolButton(this, "x-filter-bookmark");
        bookmark_button_->setCursor(Qt::ArrowCursor);
        bookmark_button_->setPopupMode(QToolButton::InstantPopup);
        bookmark_button_->setToolTip(tr("Manage saved bookmarks."));
        bookmark_button_->setIconSize(QSize(14, 14));
        bookmark_button_->setStyleSheet(
                    "QToolButton {"
                    "  border: none;"
                    "  background: transparent;" // Disables platform style on Windows.
                    "  padding: 0 0 0 0;"
                    "}"
                    "QToolButton::menu-indicator { image: none; }"
            );
        connect(bookmark_button_, SIGNAL(clicked()), this, SLOT(bookmarkClicked()));
    }

    if (!plain_) {
        clear_button_ = new StockIconToolButton(this, "x-filter-clear");
        clear_button_->setCursor(Qt::ArrowCursor);
        clear_button_->setToolTip(QString());
        clear_button_->setIconSize(QSize(14, 14));
        clear_button_->setStyleSheet(
                "QToolButton {"
                "  border: none;"
                "  background: transparent;" // Disables platform style on Windows.
                "  padding: 0 0 0 0;"
                "  margin-left: 1px;"
                "}"
                );
        connect(clear_button_, SIGNAL(clicked()), this, SLOT(clear()));
    }

    connect(this, SIGNAL(textChanged(const QString&)), this, SLOT(checkFilter(const QString&)));

    if (!plain_) {
        apply_button_ = new StockIconToolButton(this, "x-filter-apply");
        apply_button_->setCursor(Qt::ArrowCursor);
        apply_button_->setEnabled(false);
        apply_button_->setToolTip(tr("Apply this filter string to the display."));
        apply_button_->setIconSize(QSize(24, 14));
        apply_button_->setStyleSheet(
                "QToolButton {"
                "  border: none;"
                "  background: transparent;" // Disables platform style on Windows.
                "  padding: 0 0 0 0;"
                "}"
                );
        connect(apply_button_, SIGNAL(clicked()), this, SLOT(applyCaptureFilter()));
        connect(this, SIGNAL(returnPressed()), this, SLOT(applyCaptureFilter()));
    }

    int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
    QSize bksz;
    if (bookmark_button_) bksz = bookmark_button_->sizeHint();
    QSize cbsz;
    if (clear_button_) cbsz = clear_button_->sizeHint();
    QSize apsz;
    if (apply_button_) apsz = apply_button_->sizeHint();

    setStyleSheet(QString(
            "CaptureFilterEdit {"
            "  padding-left: %1px;"
            "  margin-left: %2px;"
            "  margin-right: %3px;"
            "}"
            )
            .arg(frameWidth + 1)
            .arg(bksz.width())
            .arg(cbsz.width() + apsz.width() + frameWidth + 1)
            );

    QThread *syntax_thread = new QThread;
    syntax_worker_ = new CaptureFilterSyntaxWorker;
    syntax_worker_->moveToThread(syntax_thread);
    connect(wsApp, SIGNAL(appInitialized()), this, SLOT(initCaptureFilter()));
    connect(syntax_thread, SIGNAL(started()), syntax_worker_, SLOT(start()));
    connect(syntax_thread, SIGNAL(started()), this, SLOT(checkFilter()));
    connect(syntax_worker_, SIGNAL(syntaxResult(QString,bool,QString)),
            this, SLOT(setFilterSyntaxState(QString,bool,QString)));
    connect(syntax_thread, SIGNAL(finished()), syntax_worker_, SLOT(deleteLater()));
    syntax_thread->start();

    checkFilter();
}
Ejemplo n.º 27
0
HelpBrowserFindBox::HelpBrowserFindBox( QWidget * parent ):
    QLineEdit(parent)
{
    setPlaceholderText(tr("Find..."));
    connect( this, SIGNAL(textChanged(QString)), this, SIGNAL(query(QString)) );
}
Ejemplo n.º 28
0
RoutingInputLineEdit::RoutingInputLineEdit( QWidget *parent ) :
    MarbleLineEdit( parent )
{
    setPlaceholderText( QObject::tr( "Address or search term..." ) );
}
Ejemplo n.º 29
0
ChatTextEdit::ChatTextEdit(QWidget *parent) :
    QTextEdit(parent)
{
    setPlaceholderText(tr("Type your message here..."));
    setAcceptRichText(false);
}
Ejemplo n.º 30
0
void WInPlaceEdit::setEmptyText(const WString& text)
{
  setPlaceholderText(text);
}