dde-dock/frame/window/traymanagerwindow.h
donghualin 1172b54b9f fix: 修复托盘区域调整尺寸的时候托盘图标不居中的问题
修改delegate类的sizeHint方法的返回值,在主窗体尺寸发生变化的时候,发送delegate的sizeHintChanged信号来保证sizeHint方法能实时调用

Log:
Influence: 任务栏上下调整尺寸的时候观察托盘图标的位置变化
Task: https://pms.uniontech.com/task-view-110311.html
Change-Id: I86b6bdc0fb991ff0a2674b0fa799add4b536a6bf
2022-05-25 09:46:10 +08:00

96 lines
2.5 KiB
C++

/*
* Copyright (C) 2022 ~ 2022 Deepin Technology Co., Ltd.
*
* Author: donghualin <donghualin@uniontech.com>
*
* Maintainer: donghualin <donghualin@uniontech.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TRAYMANAGERWINDOW_H
#define TRAYMANAGERWINDOW_H
#include "constants.h"
#include <QWidget>
#include <com_deepin_daemon_timedate.h>
namespace Dtk { namespace Gui { class DRegionMonitor; };
namespace Widget { class DBlurEffectWidget; } }
using namespace Dtk::Widget;
using Timedate = com::deepin::daemon::Timedate;
class QuickPluginWindow;
class QBoxLayout;
class TrayGridView;
class TrayModel;
class TrayDelegate;
class SystemPluginWindow;
class QLabel;
class QDropEvent;
class DateTimeDisplayer;
class TrayManagerWindow : public QWidget
{
Q_OBJECT
Q_SIGNALS:
void sizeChanged();
public:
explicit TrayManagerWindow(QWidget *parent = nullptr);
~TrayManagerWindow() override;
void setPositon(Dock::Position position);
QSize suitableSize();
protected:
void resizeEvent(QResizeEvent *event) override;
void dragEnterEvent(QDragEnterEvent *e) override;
void dragMoveEvent(QDragMoveEvent *e) override;
void dropEvent(QDropEvent *e) override;
void dragLeaveEvent(QDragLeaveEvent *event) override;
private:
void initUi();
void initConnection();
void resetDirection();
void resetChildWidgetSize();
void resetMultiDirection();
void resetSingleDirection();
bool showSingleRow();
int appDatetimeSize();
private:
DBlurEffectWidget *m_appPluginDatetimeWidget;
SystemPluginWindow *m_systemPluginWidget;
QWidget *m_appPluginWidget;
QuickPluginWindow *m_quickIconWidget;
DateTimeDisplayer *m_dateTimeWidget;
QBoxLayout *m_appPluginLayout;
QBoxLayout *m_appDatetimeLayout;
QBoxLayout *m_mainLayout;
TrayGridView *m_trayView;
TrayModel *m_model;
TrayDelegate *m_delegate;
Dock::Position m_postion;
QLabel *m_splitLine;
};
#endif // PLUGINWINDOW_H