mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 18:56:34 +01:00
LocationBar: Don't paint cursor when showing most visited in popup.
This commit is contained in:
parent
8a1502c9cf
commit
09cf53a292
@ -28,6 +28,7 @@ LocationCompleter::LocationCompleter(QObject* parent)
|
|||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
, m_locationBar(0)
|
, m_locationBar(0)
|
||||||
, m_ignoreCurrentChangedSignal(false)
|
, m_ignoreCurrentChangedSignal(false)
|
||||||
|
, m_showingMostVisited(false)
|
||||||
{
|
{
|
||||||
if (!s_view) {
|
if (!s_view) {
|
||||||
s_model = new LocationCompleterModel;
|
s_model = new LocationCompleterModel;
|
||||||
@ -43,28 +44,33 @@ void LocationCompleter::setLocationBar(LocationBar* locationBar)
|
|||||||
m_locationBar = locationBar;
|
m_locationBar = locationBar;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LocationCompleter::isPopupVisible()
|
bool LocationCompleter::showingMostVisited() const
|
||||||
|
{
|
||||||
|
return m_showingMostVisited;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool LocationCompleter::isPopupVisible() const
|
||||||
{
|
{
|
||||||
return s_view->isVisible();
|
return s_view->isVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocationCompleter::closePopup()
|
void LocationCompleter::closePopup()
|
||||||
{
|
{
|
||||||
|
m_showingMostVisited = false;
|
||||||
s_view->close();
|
s_view->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocationCompleter::complete(const QString &string)
|
void LocationCompleter::complete(const QString &string)
|
||||||
{
|
{
|
||||||
s_model->refreshCompletions(string);
|
m_showingMostVisited = string.isEmpty();
|
||||||
|
|
||||||
|
s_model->refreshCompletions(string);
|
||||||
showPopup();
|
showPopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocationCompleter::showMostVisited()
|
void LocationCompleter::showMostVisited()
|
||||||
{
|
{
|
||||||
s_model->refreshCompletions(QString());
|
complete(QString());
|
||||||
|
|
||||||
showPopup();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocationCompleter::currentChanged(const QModelIndex &index)
|
void LocationCompleter::currentChanged(const QModelIndex &index)
|
||||||
|
@ -36,7 +36,8 @@ public:
|
|||||||
|
|
||||||
void setLocationBar(LocationBar* locationBar);
|
void setLocationBar(LocationBar* locationBar);
|
||||||
|
|
||||||
bool isPopupVisible();
|
bool showingMostVisited() const;
|
||||||
|
bool isPopupVisible() const;
|
||||||
void closePopup();
|
void closePopup();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
@ -58,6 +59,7 @@ private:
|
|||||||
LocationBar* m_locationBar;
|
LocationBar* m_locationBar;
|
||||||
QString m_originalText;
|
QString m_originalText;
|
||||||
bool m_ignoreCurrentChangedSignal;
|
bool m_ignoreCurrentChangedSignal;
|
||||||
|
bool m_showingMostVisited;
|
||||||
|
|
||||||
static LocationCompleterView* s_view;
|
static LocationCompleterView* s_view;
|
||||||
static LocationCompleterModel* s_model;
|
static LocationCompleterModel* s_model;
|
||||||
|
@ -85,7 +85,7 @@ LocationBar::LocationBar(QupZilla* mainClass)
|
|||||||
|
|
||||||
connect(this, SIGNAL(textEdited(QString)), this, SLOT(textEdit()));
|
connect(this, SIGNAL(textEdited(QString)), this, SLOT(textEdit()));
|
||||||
connect(m_goIcon, SIGNAL(clicked(QPoint)), this, SLOT(urlEnter()));
|
connect(m_goIcon, SIGNAL(clicked(QPoint)), this, SLOT(urlEnter()));
|
||||||
connect(down, SIGNAL(clicked(QPoint)), this, SLOT(showMostVisited()));
|
connect(down, SIGNAL(clicked(QPoint)), &m_completer, SLOT(showMostVisited()));
|
||||||
connect(mApp->searchEnginesManager(), SIGNAL(activeEngineChanged()), this, SLOT(updatePlaceHolderText()));
|
connect(mApp->searchEnginesManager(), SIGNAL(activeEngineChanged()), this, SLOT(updatePlaceHolderText()));
|
||||||
connect(mApp->searchEnginesManager(), SIGNAL(defaultEngineChanged()), this, SLOT(updatePlaceHolderText()));
|
connect(mApp->searchEnginesManager(), SIGNAL(defaultEngineChanged()), this, SLOT(updatePlaceHolderText()));
|
||||||
connect(mApp, SIGNAL(message(Qz::AppMessageType, bool)), SLOT(onMessage(Qz::AppMessageType, bool)));
|
connect(mApp, SIGNAL(message(Qz::AppMessageType, bool)), SLOT(onMessage(Qz::AppMessageType, bool)));
|
||||||
@ -226,11 +226,6 @@ void LocationBar::hideGoButton()
|
|||||||
updateTextMargins();
|
updateTextMargins();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocationBar::showMostVisited()
|
|
||||||
{
|
|
||||||
m_completer.complete(QString());
|
|
||||||
}
|
|
||||||
|
|
||||||
void LocationBar::showRSSIcon(bool state)
|
void LocationBar::showRSSIcon(bool state)
|
||||||
{
|
{
|
||||||
m_rssIcon->setVisible(state);
|
m_rssIcon->setVisible(state);
|
||||||
@ -577,8 +572,9 @@ void LocationBar::hideProgress()
|
|||||||
|
|
||||||
void LocationBar::paintEvent(QPaintEvent* event)
|
void LocationBar::paintEvent(QPaintEvent* event)
|
||||||
{
|
{
|
||||||
if (m_completer.isPopupVisible()) {
|
if (m_completer.isPopupVisible() && !m_completer.showingMostVisited()) {
|
||||||
// We need to draw cursor
|
// We need to draw cursor when popup is visible
|
||||||
|
// But don't paint it if we are just showing most visited sites
|
||||||
LineEdit::paintEvent(event);
|
LineEdit::paintEvent(event);
|
||||||
|
|
||||||
QStyleOptionFrameV3 option;
|
QStyleOptionFrameV3 option;
|
||||||
|
@ -60,7 +60,6 @@ protected:
|
|||||||
void paintEvent(QPaintEvent* event);
|
void paintEvent(QPaintEvent* event);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void showMostVisited();
|
|
||||||
void textEdit();
|
void textEdit();
|
||||||
void urlEnter();
|
void urlEnter();
|
||||||
void pasteAndGo();
|
void pasteAndGo();
|
||||||
|
@ -20,7 +20,9 @@
|
|||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
class NavigationContainer : public QWidget
|
#include "qzsettings.h"
|
||||||
|
|
||||||
|
class QT_QUPZILLA_EXPORT NavigationContainer : public QWidget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit NavigationContainer(QWidget* parent = 0);
|
explicit NavigationContainer(QWidget* parent = 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user