弹窗滚动区域优化
This commit is contained in:
parent
b7aa610c36
commit
7b5ef06152
|
@ -23,8 +23,7 @@
|
|||
#include "xatom-helper.h"
|
||||
#define MAIN_SIZE_EXPAND 480,580
|
||||
#define MAIN_SIZE_NARROW 480,484
|
||||
#define PEAP_SCRO_HEIGHT 390
|
||||
#define TLS_SCRO_HEIGHT 590
|
||||
#define SCROAREA_WIDTH 480
|
||||
#define MAIN_LAYOUT_MARGINS 0,0,0,0
|
||||
#define CENTER_LAYOUT_MARGINS 24, 16, 24, 8
|
||||
#define BUTTON_LAYOUT_MARGINS 24, 24, 24, 24
|
||||
|
@ -127,7 +126,12 @@ void EnterpriseWlanDialog::initUI()
|
|||
m_enterWlanScrollArea = new QScrollArea(this);
|
||||
m_enterWlanScrollArea->setFrameShape(QFrame::NoFrame);
|
||||
m_enterWlanScrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
|
||||
m_centerWidget->setFixedWidth(SCROAREA_WIDTH);
|
||||
m_enterWlanScrollArea->setFixedWidth(SCROAREA_WIDTH);
|
||||
m_enterWlanScrollArea->setWidget(m_centerWidget);
|
||||
m_enterWlanScrollArea->setWidgetResizable(true);
|
||||
|
||||
QPalette pal = m_enterWlanScrollArea->palette();
|
||||
pal.setBrush(QPalette::Window, Qt::transparent);
|
||||
m_enterWlanScrollArea->setPalette(pal);
|
||||
|
@ -254,21 +258,18 @@ void EnterpriseWlanDialog::onEapTypeChanged(const KyEapMethodType &type)
|
|||
m_resource->getEnterPriseInfoTls(m_wirelessNetItem.m_connectUuid, m_info.tlsInfo);
|
||||
}
|
||||
this->setFixedSize(MAIN_SIZE_EXPAND);
|
||||
m_centerWidget->setFixedHeight(TLS_SCRO_HEIGHT);
|
||||
break;
|
||||
case KyEapMethodType::PEAP:
|
||||
if (m_wirelessNetItem.m_connectUuid.isEmpty()) {
|
||||
m_resource->getEnterPriseInfoPeap(m_wirelessNetItem.m_connectUuid, m_info.peapInfo);
|
||||
}
|
||||
this->setFixedSize(MAIN_SIZE_NARROW);
|
||||
m_centerWidget->setFixedHeight(PEAP_SCRO_HEIGHT);
|
||||
break;
|
||||
case KyEapMethodType::TTLS:
|
||||
if (!m_wirelessNetItem.m_connectUuid.isEmpty()) {
|
||||
m_resource->getEnterPriseInfoTtls(m_wirelessNetItem.m_connectUuid, m_info.ttlsInfo);
|
||||
}
|
||||
this->setFixedSize(MAIN_SIZE_NARROW);
|
||||
m_centerWidget->setFixedHeight(PEAP_SCRO_HEIGHT);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -30,9 +30,7 @@
|
|||
#define LAYOUT_SPACING 16
|
||||
#define LABEL_MIN_WIDTH 146
|
||||
#define MAX_NAME_LENGTH 32
|
||||
#define PSK_SCRO_HEIGHT 182
|
||||
#define PEAP_SCRO_HEIGHT 340
|
||||
#define TLS_SCRO_HEIGHT 560
|
||||
#define SCROAREA_WIDTH 480
|
||||
#define MEDIUM_WEIGHT_VALUE 57
|
||||
|
||||
JoinHiddenWiFiPage::JoinHiddenWiFiPage(QString devName, KDialog *parent)
|
||||
|
@ -44,7 +42,6 @@ JoinHiddenWiFiPage::JoinHiddenWiFiPage(QString devName, KDialog *parent)
|
|||
initUI();
|
||||
initComponent();
|
||||
|
||||
setFixedWidth(WINDOW_WIDTH);
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
setJoinBtnEnable();
|
||||
|
@ -115,8 +112,11 @@ void JoinHiddenWiFiPage::initUI()
|
|||
m_centerVBoxLayout->addWidget(ssidWidget);
|
||||
m_centerVBoxLayout->addSpacing(LAYOUT_SPACING);
|
||||
m_centerVBoxLayout->addWidget(m_secuWidget);
|
||||
m_centerVBoxLayout->addStretch();
|
||||
|
||||
m_centerWidget->setFixedWidth(SCROAREA_WIDTH);
|
||||
m_hiddenWifiScrollArea->setFixedWidth(SCROAREA_WIDTH);
|
||||
m_hiddenWifiScrollArea->setWidget(m_centerWidget);
|
||||
m_hiddenWifiScrollArea->setWidgetResizable(true);
|
||||
|
||||
//底部按钮
|
||||
m_bottomLayout = new QHBoxLayout(m_bottomWidget);
|
||||
|
@ -143,7 +143,7 @@ void JoinHiddenWiFiPage::initUI()
|
|||
|
||||
this->setWindowTitle(tr("Find and Join Wi-Fi"));
|
||||
this->setWindowIcon(QIcon::fromTheme("kylin-network"));
|
||||
|
||||
this->setFixedWidth(WINDOW_WIDTH);
|
||||
this->setFixedHeight(MIN_WINDOW_HEIGHT);
|
||||
}
|
||||
|
||||
|
@ -217,7 +217,6 @@ void JoinHiddenWiFiPage::onSecuTypeChanged(const KySecuType &type)
|
|||
{
|
||||
if (type != KySecuType::WPA_AND_WPA2_ENTERPRISE) {
|
||||
this->setFixedHeight(MIN_WINDOW_HEIGHT);
|
||||
m_centerWidget->setFixedSize(WINDOW_WIDTH, PSK_SCRO_HEIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -225,10 +224,8 @@ void JoinHiddenWiFiPage::onEapTypeChanged(const KyEapMethodType &type)
|
|||
{
|
||||
if (type == KyEapMethodType::TLS) {
|
||||
this->setFixedHeight(TLS_WINDOW_HEIGHT);
|
||||
m_centerWidget->setFixedSize(WINDOW_WIDTH, TLS_SCRO_HEIGHT);
|
||||
} else if (type == KyEapMethodType::PEAP || type == KyEapMethodType::TTLS) {
|
||||
this->setFixedHeight(PEAP_WINDOW_HEIGHT);
|
||||
m_centerWidget->setFixedSize(WINDOW_WIDTH, PEAP_SCRO_HEIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,6 @@
|
|||
#define CENTER_LAYOUT_MARGINS 24,0,0,0
|
||||
#define BOTTOM_LAYOUT_MARGINS 24,0,24,0
|
||||
#define BOTTOM_LAYOUT_SPACING 16
|
||||
#define PAGE_LAYOUT_SPACING 1
|
||||
#define DETAIL_PAGE_NUM 0
|
||||
#define IPV4_PAGE_NUM 1
|
||||
#define IPV6_PAGE_NUM 2
|
||||
|
@ -49,9 +48,11 @@
|
|||
#define CONFIG_PAGE_NUM 4
|
||||
#define CREATE_NET_PAGE_NUM 5
|
||||
#define PAGE_MIN_HEIGHT 40
|
||||
#define PAGE_WIDTH 472
|
||||
#define LAN_TAB_WIDTH 180
|
||||
#define WLAN_TAB_WIDTH 240
|
||||
#define SCRO_WIDTH 472
|
||||
#define SCRO_WIDTH 496
|
||||
#define SCRO_HEIGHT 600
|
||||
#define PEAP_SCRO_HEIGHT 300
|
||||
#define TLS_SCRO_HEIGHT 480
|
||||
#define MAX_TAB_TEXT_LENGTH 44
|
||||
|
@ -169,7 +170,7 @@ NetDetail::NetDetail(QString interface, QString name, QString uuid, bool isActiv
|
|||
getConInfo(m_info);
|
||||
startObjectThread();
|
||||
pagePadding(name,isWlan);
|
||||
setSecuPageHeight();
|
||||
|
||||
connect(qApp, &QApplication::paletteChanged, this, &NetDetail::onPaletteChanged);
|
||||
|
||||
isCreateOk = !(m_isCreateNet && !isWlan);
|
||||
|
@ -286,56 +287,66 @@ void NetDetail::initUI()
|
|||
{
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout(this);
|
||||
mainLayout->setContentsMargins(0,9,0,24);
|
||||
mainLayout->setSpacing(24);
|
||||
mainLayout->setSpacing(22);
|
||||
|
||||
this->installEventFilter(this);
|
||||
pageFrame = new QFrame(this);
|
||||
centerWidget = new QWidget(this);
|
||||
bottomWidget = new QWidget(this);
|
||||
|
||||
detailPage = new DetailPage(isWlan, m_name.isEmpty(), this);
|
||||
|
||||
ipv4Page = new Ipv4Page(this);
|
||||
ipv6Page = new Ipv6Page(this);
|
||||
securityPage = new SecurityPage(this);
|
||||
createNetPage = new CreatNetPage(this);
|
||||
configPage = new ConfigPage(this);
|
||||
|
||||
this->installEventFilter(this);
|
||||
detailPage->setFixedWidth(PAGE_WIDTH);
|
||||
ipv4Page->setFixedWidth(PAGE_WIDTH);
|
||||
ipv6Page->setFixedWidth(PAGE_WIDTH);
|
||||
securityPage->setFixedWidth(PAGE_WIDTH);
|
||||
createNetPage->setFixedWidth(PAGE_WIDTH);
|
||||
configPage->setFixedWidth(PAGE_WIDTH);
|
||||
|
||||
centerWidget = new QWidget(this);
|
||||
bottomWidget = new QWidget(this);
|
||||
|
||||
m_secuPageScrollArea = new QScrollArea(this);
|
||||
// 滚动区域
|
||||
m_secuPageScrollArea = new QScrollArea(centerWidget);
|
||||
m_secuPageScrollArea->setFixedWidth(SCRO_WIDTH);
|
||||
m_secuPageScrollArea->setFrameShape(QFrame::NoFrame);
|
||||
m_secuPageScrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
m_secuPageScrollArea->setWidget(securityPage);
|
||||
m_secuPageScrollArea->setWidgetResizable(true);
|
||||
|
||||
m_ipv4ScrollArea = new QScrollArea(centerWidget);
|
||||
m_ipv4ScrollArea->setFixedWidth(SCRO_WIDTH);
|
||||
m_ipv4ScrollArea->setFrameShape(QFrame::NoFrame);
|
||||
m_ipv4ScrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
m_ipv4ScrollArea->setWidget(ipv4Page);
|
||||
m_ipv4ScrollArea->setWidgetResizable(true);
|
||||
|
||||
m_ipv6ScrollArea = new QScrollArea(centerWidget);
|
||||
m_ipv6ScrollArea->setFixedWidth(SCRO_WIDTH);
|
||||
m_ipv6ScrollArea->setFrameShape(QFrame::NoFrame);
|
||||
m_ipv6ScrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
m_ipv6ScrollArea->setWidget(ipv6Page);
|
||||
m_ipv6ScrollArea->setWidgetResizable(true);
|
||||
|
||||
QPalette pal = m_secuPageScrollArea->palette();
|
||||
pal.setBrush(QPalette::Window, Qt::transparent);
|
||||
m_secuPageScrollArea->setPalette(pal);
|
||||
|
||||
detailPage->setFixedWidth(SCRO_WIDTH);
|
||||
ipv4Page->setFixedWidth(SCRO_WIDTH);
|
||||
ipv6Page->setFixedWidth(SCRO_WIDTH);
|
||||
createNetPage->setFixedWidth(SCRO_WIDTH);
|
||||
configPage->setFixedWidth(SCRO_WIDTH);
|
||||
m_ipv4ScrollArea->setPalette(pal);
|
||||
m_ipv6ScrollArea->setPalette(pal);
|
||||
|
||||
stackWidget = new QStackedWidget(centerWidget);
|
||||
stackWidget->addWidget(detailPage);
|
||||
stackWidget->addWidget(ipv4Page);
|
||||
stackWidget->addWidget(ipv6Page);
|
||||
stackWidget->addWidget(m_ipv4ScrollArea);
|
||||
stackWidget->addWidget(m_ipv6ScrollArea);
|
||||
stackWidget->addWidget(m_secuPageScrollArea);
|
||||
stackWidget->addWidget(configPage);
|
||||
stackWidget->addWidget(createNetPage);
|
||||
|
||||
mainLayout->addWidget(centerWidget);
|
||||
mainLayout->addWidget(bottomWidget);
|
||||
|
||||
bottomWidget->setMinimumHeight(PAGE_MIN_HEIGHT);
|
||||
|
||||
pageFrame = new QFrame(this);
|
||||
QHBoxLayout *pageLayout = new QHBoxLayout(pageFrame);
|
||||
// pageLayout->setSpacing(PAGE_LAYOUT_SPACING);
|
||||
|
||||
// TabBar
|
||||
// m_netTabBar = new KTabBar(KTabBarStyle::SegmentDark, this);
|
||||
m_netTabBar = new NetTabBar(this);
|
||||
m_netTabBar->setTabBarStyle(KTabBarStyle::SegmentDark);
|
||||
m_netTabBar->addTab(tr("Detail")); //详情
|
||||
m_netTabBar->addTab(tr("IPv4"));//Ipv4
|
||||
m_netTabBar->addTab(tr("IPv6"));//Ipv6
|
||||
|
@ -356,27 +367,26 @@ void NetDetail::initUI()
|
|||
}
|
||||
}
|
||||
|
||||
pageLayout->addWidget(m_netTabBar, Qt::AlignCenter);
|
||||
pageLayout->addSpacing(24);
|
||||
|
||||
// TabBar关联选项卡页面
|
||||
connect(m_netTabBar, SIGNAL(currentChanged(int)), this, SLOT(currentRowChangeSlot(int)));
|
||||
setNetTabToolTip();
|
||||
|
||||
confimBtn = new QPushButton(this);
|
||||
confimBtn->setText(tr("Confirm"));
|
||||
|
||||
cancelBtn = new QPushButton(this);
|
||||
cancelBtn->setText(tr("Cancel"));
|
||||
|
||||
forgetBtn = new QPushButton(this);
|
||||
|
||||
QHBoxLayout *pageLayout = new QHBoxLayout(pageFrame);
|
||||
pageLayout->setContentsMargins(0, 0, 0, 0);
|
||||
pageLayout->addWidget(m_netTabBar, Qt::AlignCenter);
|
||||
|
||||
QVBoxLayout *centerlayout = new QVBoxLayout(centerWidget);
|
||||
centerlayout->setContentsMargins(CENTER_LAYOUT_MARGINS); // 右边距为0,为安全页滚动区域留出空间
|
||||
centerlayout->addWidget(pageFrame);
|
||||
centerlayout->addSpacing(4);
|
||||
centerlayout->addWidget(stackWidget);
|
||||
|
||||
// centerWidget->setStyleSheet("QWidget{border:1px solid rgba(255,0,0,1);}");//测试用, 画出边界线
|
||||
|
||||
QHBoxLayout *bottomLayout = new QHBoxLayout(bottomWidget);
|
||||
bottomLayout->setContentsMargins(BOTTOM_LAYOUT_MARGINS);
|
||||
bottomLayout->setSpacing(BOTTOM_LAYOUT_SPACING);
|
||||
|
@ -384,11 +394,13 @@ void NetDetail::initUI()
|
|||
bottomLayout->addStretch();
|
||||
bottomLayout->addWidget(cancelBtn);
|
||||
bottomLayout->addWidget(confimBtn);
|
||||
bottomWidget->setMinimumHeight(PAGE_MIN_HEIGHT);
|
||||
|
||||
mainLayout->addWidget(pageFrame);
|
||||
mainLayout->addWidget(centerWidget);
|
||||
mainLayout->addWidget(bottomWidget);
|
||||
|
||||
// QPalette pal(this->palette());
|
||||
// pal.setColor(QPalette::Background, qApp->palette().base().color());
|
||||
this->setAutoFillBackground(true);
|
||||
// this->setPalette(pal);
|
||||
onPaletteChanged();
|
||||
}
|
||||
|
||||
|
@ -452,13 +464,6 @@ void NetDetail::initComponent()
|
|||
setConfirmEnable();
|
||||
});
|
||||
|
||||
connect(securityPage, &SecurityPage::secuTypeChanged, this, [=]() {
|
||||
setSecuPageHeight();
|
||||
});
|
||||
connect(securityPage, &SecurityPage::eapTypeChanged, this, [=]() {
|
||||
setSecuPageHeight();
|
||||
});
|
||||
|
||||
const QByteArray id(THEME_SCHAME);
|
||||
if(QGSettings::isSchemaInstalled(id)){
|
||||
QGSettings * fontSetting = new QGSettings(id, QByteArray(), this);
|
||||
|
@ -740,22 +745,6 @@ void NetDetail::initSecuData()
|
|||
}
|
||||
}
|
||||
|
||||
void NetDetail::setSecuPageHeight()
|
||||
{
|
||||
KySecuType secuType;
|
||||
KyEapMethodType eapType;
|
||||
securityPage->getSecuType(secuType, eapType);
|
||||
if (secuType == WPA_AND_WPA2_ENTERPRISE) {
|
||||
if (eapType == TLS) {
|
||||
securityPage->setFixedSize(SCRO_WIDTH, TLS_SCRO_HEIGHT);
|
||||
} else {
|
||||
securityPage->setFixedSize(SCRO_WIDTH, PEAP_SCRO_HEIGHT);
|
||||
}
|
||||
} else {
|
||||
securityPage->setFixedSize(SCRO_WIDTH, PEAP_SCRO_HEIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
void NetDetail::initTlsInfo(ConInfo &conInfo)
|
||||
{
|
||||
m_resource->getEnterPriseInfoTls(m_uuid, conInfo.tlsInfo);
|
||||
|
@ -1146,6 +1135,7 @@ void NetDetail::setNetTabToolTip()
|
|||
}
|
||||
|
||||
NetTabBar::NetTabBar(QWidget *parent)
|
||||
:KTabBar(KTabBarStyle::SegmentDark, parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -1157,16 +1147,19 @@ NetTabBar::~NetTabBar()
|
|||
|
||||
QSize NetTabBar::sizeHint() const
|
||||
{
|
||||
return QSize(TAB_WIDTH, TAB_HEIGHT);
|
||||
QSize size = KTabBar::sizeHint();
|
||||
size.setWidth(TAB_WIDTH);
|
||||
return size;
|
||||
}
|
||||
|
||||
QSize NetTabBar::minimumTabSizeHint(int index) const
|
||||
{
|
||||
Q_UNUSED(index)
|
||||
return QSize(TAB_WIDTH, TAB_HEIGHT);
|
||||
QSize size = KTabBar::minimumTabSizeHint(index);
|
||||
size.setWidth(TAB_WIDTH);
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
ThreadObject::ThreadObject(QString deviceName, QObject *parent)
|
||||
:m_devName(deviceName), QObject(parent)
|
||||
{
|
||||
|
|
|
@ -55,6 +55,7 @@ using namespace kdk;
|
|||
|
||||
#define TAB_WIDTH 60
|
||||
#define TAB_HEIGHT 36
|
||||
#define TAB_HEIGHT_TABLET 48
|
||||
|
||||
class NetTabBar : public KTabBar
|
||||
{
|
||||
|
@ -62,9 +63,10 @@ class NetTabBar : public KTabBar
|
|||
public:
|
||||
explicit NetTabBar(QWidget *parent = nullptr);
|
||||
~NetTabBar();
|
||||
|
||||
protected:
|
||||
QSize sizeHint() const;
|
||||
QSize minimumTabSizeHint(int index) const;
|
||||
|
||||
};
|
||||
class ThreadObject : public QObject
|
||||
{
|
||||
|
@ -106,7 +108,6 @@ private:
|
|||
void loadPage();
|
||||
void pagePadding(QString netName, bool isWlan);
|
||||
void initSecuData();
|
||||
void setSecuPageHeight();
|
||||
|
||||
void initTlsInfo(ConInfo &conInfo);
|
||||
void initPeapInfo(ConInfo &conInfo);
|
||||
|
@ -158,6 +159,8 @@ private:
|
|||
QWidget * centerWidget;
|
||||
QWidget * bottomWidget;
|
||||
QScrollArea * m_secuPageScrollArea;
|
||||
QScrollArea * m_ipv4ScrollArea;
|
||||
QScrollArea * m_ipv6ScrollArea;
|
||||
|
||||
QPushButton * cancelBtn;
|
||||
QPushButton * forgetBtn;
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#define DETAIL_MIN_LABEL_WIDTH 80
|
||||
#define DETAIL_MIN_EDIT_WIDTH 390
|
||||
#define MIN_LABEL_WIDTH 146
|
||||
#define MIN_EDIT_WIDTH 278
|
||||
#define MIN_EDIT_WIDTH 286
|
||||
|
||||
SecurityPage::SecurityPage(bool isNetDetailPage, QWidget *parent) : isDetailPage(isNetDetailPage), QFrame(parent)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue