mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 18:56:34 +01:00
BookmarksSideBar: Get focus to search line when opening sidebar
- also addeed support for opening bookmarks with Enter * Enter - opens bookmark in current tab * Ctrl + Enter - opens bookmark in new tab
This commit is contained in:
parent
2c57528d29
commit
d5e21ab911
@ -30,6 +30,7 @@
|
|||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
#include <QSqlQuery>
|
#include <QSqlQuery>
|
||||||
|
#include <QKeyEvent>
|
||||||
|
|
||||||
BookmarksSideBar::BookmarksSideBar(QupZilla* mainClass, QWidget* parent)
|
BookmarksSideBar::BookmarksSideBar(QupZilla* mainClass, QWidget* parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
@ -233,6 +234,24 @@ void BookmarksSideBar::renameFolder(const QString &before, const QString &after)
|
|||||||
item->setText(0, after);
|
item->setText(0, after);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BookmarksSideBar::keyPressEvent(QKeyEvent* event)
|
||||||
|
{
|
||||||
|
if (event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) {
|
||||||
|
QTreeWidgetItem* item = ui->bookmarksTree->currentItem();
|
||||||
|
|
||||||
|
if (event->modifiers() & Qt::ControlModifier) {
|
||||||
|
itemControlClicked(item);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
itemDoubleClicked(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QWidget::keyPressEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
void BookmarksSideBar::refreshTable()
|
void BookmarksSideBar::refreshTable()
|
||||||
{
|
{
|
||||||
m_isRefreshing = true;
|
m_isRefreshing = true;
|
||||||
@ -293,6 +312,8 @@ void BookmarksSideBar::refreshTable()
|
|||||||
|
|
||||||
ui->bookmarksTree->setUpdatesEnabled(true);
|
ui->bookmarksTree->setUpdatesEnabled(true);
|
||||||
m_isRefreshing = false;
|
m_isRefreshing = false;
|
||||||
|
|
||||||
|
ui->search->setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
BookmarksSideBar::~BookmarksSideBar()
|
BookmarksSideBar::~BookmarksSideBar()
|
||||||
|
@ -62,6 +62,8 @@ private slots:
|
|||||||
void renameFolder(const QString &before, const QString &after);
|
void renameFolder(const QString &before, const QString &after);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void keyPressEvent(QKeyEvent* event);
|
||||||
|
|
||||||
QupZilla* getQupZilla();
|
QupZilla* getQupZilla();
|
||||||
|
|
||||||
bool m_isRefreshing;
|
bool m_isRefreshing;
|
||||||
|
@ -31,6 +31,9 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="closeButton">
|
<widget class="QToolButton" name="closeButton">
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::NoFocus</enum>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
|
Loading…
Reference in New Issue
Block a user