forked from openkylin/ukui-menu
修改全屏开始菜单无法触摸滑动问题
This commit is contained in:
parent
9a38098d9a
commit
a62527f01c
|
@ -18,7 +18,6 @@
|
|||
|
||||
#include "convert_winid_to_desktop.h"
|
||||
#include "utility.h"
|
||||
#include <KWindowSystem>
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
|
|
|
@ -69,14 +69,21 @@ void KListView::mouseMoveEvent(QMouseEvent *e)
|
|||
|
||||
void KListView::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
if (!(this->indexAt(event->pos()).isValid()) && event->button() == Qt::LeftButton) {
|
||||
Q_EMIT sendHideMainWindowSignal();
|
||||
} else {
|
||||
if ((this->indexAt(event->pos()).isValid()) && event->button() == Qt::LeftButton) {
|
||||
pressApp = listmodel->data(this->indexAt(event->pos()), Qt::DisplayRole);
|
||||
}
|
||||
return QListView::mousePressEvent(event);
|
||||
}
|
||||
|
||||
void KListView::mouseReleaseEvent(QMouseEvent *e)
|
||||
{
|
||||
if (!(this->indexAt(e->pos()).isValid()) && e->button() == Qt::LeftButton) {
|
||||
Q_EMIT sendHideMainWindowSignal();
|
||||
} else {
|
||||
return QListView::mouseReleaseEvent(e);
|
||||
}
|
||||
}
|
||||
|
||||
void KListView::rightClickedSlot(const QPoint &pos)
|
||||
{
|
||||
if (!(this->selectionModel()->selectedIndexes().isEmpty())) {
|
||||
|
|
|
@ -24,6 +24,7 @@ protected:
|
|||
void paintEvent(QPaintEvent *e);
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void mouseMoveEvent(QMouseEvent *e);
|
||||
void mouseReleaseEvent(QMouseEvent *e);
|
||||
public:
|
||||
void addData(QStringList data);
|
||||
void updateData(QStringList data);
|
||||
|
|
|
@ -74,23 +74,13 @@ void ScrollAreaWid::paintEvent(QPaintEvent *event)
|
|||
|
||||
ScrollArea::ScrollArea()
|
||||
{
|
||||
// this->verticalScrollBar()->setVisible(false);
|
||||
// this->setFocusPolicy(Qt::NoFocus);
|
||||
//// this->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||
this->setFixedWidth(1330);
|
||||
// this->verticalScrollBar()->setContextMenuPolicy(Qt::NoContextMenu);
|
||||
this->setFocusPolicy(Qt::NoFocus);
|
||||
this->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
||||
this->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
||||
this->setFrameShape(QFrame::NoFrame);
|
||||
// this->verticalScrollBar()->setProperty("drawScrollBarGroove",false);
|
||||
// this->verticalScrollBar()->setAttribute(Qt::WA_TranslucentBackground, false);
|
||||
this->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
this->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
this->verticalScrollBar()->setVisible(false);
|
||||
//滚动条设置
|
||||
QPalette p = this->verticalScrollBar()->palette();
|
||||
QColor color(255, 255, 255);
|
||||
color.setAlphaF(0.25);
|
||||
p.setColor(QPalette::Active, QPalette::Button, color);
|
||||
this->verticalScrollBar()->setPalette(p);
|
||||
this->horizontalScrollBar()->setVisible(false);
|
||||
this->setStyleSheet("QWidget{background:transparent;}");
|
||||
}
|
||||
|
||||
void ScrollArea::setFocusToNextChild()
|
||||
|
|
|
@ -48,11 +48,11 @@ void FullCommonUseWidget::initUi()
|
|||
m_scrollArea = new ScrollArea();
|
||||
m_scrollAreaWid = new ScrollAreaWid(this);
|
||||
m_scrollAreaWid->setAttribute(Qt::WA_TranslucentBackground);
|
||||
m_scrollArea->setFixedSize(Style::m_applistWidWidth, Style::m_applistWidHeight);
|
||||
m_scrollArea->setFixedSize(Style::m_applistAreaWidth, Style::m_applistWidHeight);
|
||||
m_scrollArea->setWidget(m_scrollAreaWid);
|
||||
m_scrollArea->setAlignment(Qt::AlignCenter);
|
||||
m_scrollArea->setStyleSheet("QWidget{background:transparent;}");
|
||||
m_scrollArea->setWidgetResizable(true);
|
||||
m_scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
m_scrollAreaWidLayout = new QVBoxLayout(m_scrollAreaWid);
|
||||
m_scrollAreaWidLayout->setContentsMargins(0, 0, 0, 0);
|
||||
m_scrollAreaWidLayout->setSpacing(10);
|
||||
|
@ -146,7 +146,7 @@ void FullCommonUseWidget::initAppListWidget()
|
|||
m_listView = new FullListView(this, 0);
|
||||
m_listView->installEventFilter(this);
|
||||
m_scrollAreaWidLayout->addWidget(m_listView);
|
||||
m_listView->setFixedWidth(m_scrollArea->width());
|
||||
m_listView->setFixedWidth(m_scrollAreaWid->width());
|
||||
connect(m_listView, &FullListView::sendItemClickedSignal, this, &FullCommonUseWidget::execApplication);
|
||||
connect(m_listView, &FullListView::sendUpdateAppListSignal, this, &FullCommonUseWidget::updateListViewSlot);
|
||||
connect(m_listView, &FullListView::sendHideMainWindowSignal, this, &FullCommonUseWidget::sendHideMainWindowSignal);
|
||||
|
@ -281,7 +281,7 @@ void FullCommonUseWidget::updateListView()
|
|||
|
||||
void FullCommonUseWidget::repaintWidget()
|
||||
{
|
||||
m_scrollArea->setFixedSize(Style::m_applistWidWidth, Style::m_applistWidHeight);
|
||||
m_scrollArea->setFixedSize(Style::m_applistAreaWidth, Style::m_applistWidHeight);
|
||||
m_scrollAreaWidLayout->removeWidget(m_listView);
|
||||
m_listView->setParent(nullptr);
|
||||
delete m_listView;
|
||||
|
|
|
@ -45,7 +45,7 @@ void FullFunctionWidget::initUi()
|
|||
m_iconListWid = new QWidget(this);
|
||||
m_iconListWid->setAttribute(Qt::WA_TranslucentBackground);
|
||||
m_iconListWid->setAutoFillBackground(false);
|
||||
m_applistWid->setFixedSize(Style::m_applistWidWidth, Style::m_applistWidHeight);
|
||||
m_applistWid->setFixedSize(Style::m_applistAreaWidth, Style::m_applistWidHeight);
|
||||
m_iconListWid->setFixedSize(Style::m_leftWidWidth, Style::m_applistWidHeight);
|
||||
m_verticalScrollBar = new QScrollBar(m_scrollArea);
|
||||
m_verticalScrollBar->installEventFilter(this);
|
||||
|
@ -111,10 +111,10 @@ void FullFunctionWidget::initAppListWidget()
|
|||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
m_applistWid->setLayout(layout);
|
||||
m_scrollArea = new ScrollArea;
|
||||
m_scrollArea->setStyleSheet("background:transparent");
|
||||
m_scrollAreaWid = new ScrollAreaWid(this);
|
||||
m_scrollAreaWid->setAttribute(Qt::WA_TranslucentBackground);
|
||||
m_scrollArea->setFixedSize(m_applistWid->width(), m_applistWid->height());
|
||||
m_scrollAreaWid->adjustSize();
|
||||
m_scrollArea->setWidget(m_scrollAreaWid);
|
||||
m_scrollArea->setWidgetResizable(true);
|
||||
m_scrollAreaWidLayout = new QVBoxLayout(m_scrollAreaWid);
|
||||
|
@ -473,7 +473,7 @@ void FullFunctionWidget::setFunctionBtnGeometry()
|
|||
|
||||
void FullFunctionWidget::repaintWidget()
|
||||
{
|
||||
m_applistWid->setFixedSize(Style::m_applistWidWidth, Style::m_applistWidHeight);
|
||||
m_applistWid->setFixedSize(Style::m_applistAreaWidth, Style::m_applistWidHeight);
|
||||
m_iconListWid->setFixedSize(Style::m_leftWidWidth, Style::m_applistWidHeight);
|
||||
m_scrollArea->setFixedSize(m_applistWid->width(), m_applistWid->height());
|
||||
updateAppListView();
|
||||
|
|
|
@ -77,12 +77,10 @@ void FullLetterWidget::initAppListWidget()
|
|||
// layout->setContentsMargins(0,0,0,0);
|
||||
// m_applistWid->setLayout(layout);
|
||||
m_scrollArea = new ScrollArea();
|
||||
m_scrollArea->setStyleSheet("background:transparent");
|
||||
m_scrollAreaWid = new ScrollAreaWid(this);
|
||||
m_scrollArea->setWidget(m_scrollAreaWid);
|
||||
m_scrollArea->setFixedSize(Style::m_applistWidWidth, Style::m_applistWidHeight);
|
||||
m_scrollArea->setWidgetResizable(true);
|
||||
// m_scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
m_scrollAreaWid->setFixedWidth(Style::m_applistWidWidth);
|
||||
m_scrollArea->setFixedSize(Style::m_applistAreaWidth, Style::m_applistWidHeight);
|
||||
m_scrollAreaWidLayout = new QVBoxLayout;
|
||||
m_scrollAreaWidLayout->setContentsMargins(0, 0, 0, 0);
|
||||
m_scrollAreaWidLayout->setSpacing(10);
|
||||
|
@ -304,12 +302,12 @@ void FullLetterWidget::resizeScrollAreaControls()
|
|||
rowcount = listview->model()->rowCount() / dividend;
|
||||
}
|
||||
|
||||
listview->setFixedSize(m_scrollArea->width(), listview->gridSize().height()*rowcount);
|
||||
listview->setFixedHeight(listview->gridSize().height()*rowcount);
|
||||
areaHeight += listview->height() + 50;
|
||||
row++;
|
||||
}
|
||||
|
||||
m_scrollArea->widget()->setFixedSize(m_scrollArea->width(), areaHeight - 10);
|
||||
m_scrollArea->widget()->setFixedHeight(areaHeight - 10);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -480,7 +478,8 @@ void FullLetterWidget::setLetterBtnGeometry()
|
|||
void FullLetterWidget::repaintWidget()
|
||||
{
|
||||
m_letterListWid->setFixedSize(Style::m_leftWidWidth, Style::m_applistWidHeight);
|
||||
m_scrollArea->setFixedSize(Style::m_applistWidWidth, Style::m_applistWidHeight);
|
||||
m_scrollArea->setFixedSize(Style::m_applistAreaWidth, Style::m_applistWidHeight);
|
||||
m_scrollAreaWid->setFixedWidth(Style::m_applistWidWidth);
|
||||
updateAppListView();
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ void FullSearchResultWidget::initUi()
|
|||
m_scrollArea->setStyleSheet("background:transparent");
|
||||
m_scrollAreaWid = new ScrollAreaWid(this);
|
||||
m_scrollAreaWid->setAttribute(Qt::WA_TranslucentBackground);
|
||||
m_scrollArea->setFixedSize(Style::m_applistWidWidth, Style::m_applistWidHeight);
|
||||
m_scrollArea->setFixedSize(Style::m_applistAreaWidth, Style::m_applistWidHeight);
|
||||
m_scrollArea->setWidget(m_scrollAreaWid);
|
||||
m_scrollArea->setWidgetResizable(true);
|
||||
m_scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
|
@ -228,7 +228,7 @@ void FullSearchResultWidget::selectFirstItemTab()
|
|||
|
||||
void FullSearchResultWidget::repaintWidget()
|
||||
{
|
||||
m_scrollArea->setFixedSize(Style::m_applistWidWidth, Style::m_applistWidHeight);
|
||||
m_scrollArea->setFixedSize(Style::m_applistAreaWidth, Style::m_applistWidHeight);
|
||||
resizeScrollAreaControls();
|
||||
m_scrollAreaWidHeight = m_scrollAreaWid->height() + 1;
|
||||
initVerticalScrollBar();
|
||||
|
|
|
@ -511,10 +511,15 @@ void FullMainWindow::searchAppSlot(QString arg)
|
|||
void FullMainWindow::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
resetEditline();
|
||||
return QMainWindow::mousePressEvent(event);
|
||||
}
|
||||
|
||||
void FullMainWindow::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton) {
|
||||
this->hide();
|
||||
}
|
||||
return QMainWindow::mousePressEvent(event);
|
||||
return QMainWindow::mouseReleaseEvent(event);
|
||||
}
|
||||
|
||||
void FullMainWindow::recvSearchResult(QVector<QStringList> arg)
|
||||
|
|
|
@ -53,6 +53,7 @@ protected:
|
|||
bool event(QEvent *event);
|
||||
bool eventFilter(QObject *watched, QEvent *event);
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void mouseReleaseEvent(QMouseEvent *event);
|
||||
void changeStyle();
|
||||
void initConnect();
|
||||
void initTabOrder();
|
||||
|
|
|
@ -56,6 +56,7 @@ int Style::LeftSpaceIconText = 0;
|
|||
int Style::LeftSpaceBetweenItem = 0;
|
||||
//应用列表栏
|
||||
int Style::m_applistWidWidth = 0;
|
||||
int Style::m_applistAreaWidth = 0;
|
||||
int Style::m_applistWidHeight = 0;
|
||||
int Style::AppListIconSize = 0;
|
||||
int Style::AppListBigIconSize = 0;
|
||||
|
@ -217,10 +218,11 @@ void Style::initWidStyle()
|
|||
rightViewHeight = 470;
|
||||
LeftSpaceIconText = 14;
|
||||
m_applistWidWidth = m_availableScreenWidth / 1.25;
|
||||
m_applistWidWidth = m_applistWidWidth - (m_applistWidWidth % m_applistGridSizeWidth) + 1;
|
||||
m_applistWidWidth = m_applistWidWidth - (m_applistWidWidth % m_applistGridSizeWidth) + 2;
|
||||
m_applistWidHeight = m_availableScreenHeight - 120;
|
||||
m_applistWidHeight = m_applistWidHeight - (m_applistWidHeight % m_applistGridSizeWidth) + 1;
|
||||
m_applistWidHeight = m_applistWidHeight - (m_applistWidHeight % m_applistGridSizeWidth);
|
||||
m_leftWidWidth = (m_availableScreenWidth - m_applistWidWidth) / 2 + 1;
|
||||
m_applistAreaWidth = m_applistWidWidth + 20;
|
||||
} else {
|
||||
ScreenWidth = QApplication::primaryScreen()->geometry().width();
|
||||
ScreenHeight = QApplication::primaryScreen()->geometry().height();
|
||||
|
|
|
@ -111,6 +111,7 @@ public:
|
|||
static int LeftSpaceBetweenItem; //item间距
|
||||
//应用列表栏
|
||||
static int m_applistWidWidth; //宽度
|
||||
static int m_applistAreaWidth;
|
||||
static int m_applistWidHeight; //高度
|
||||
static int AppListIconSize; //图标大小
|
||||
static int AppListBigIconSize;
|
||||
|
|
Loading…
Reference in New Issue