Skip to content

Commit 6ce7bcb

Browse files
committed
add change implementation need of getting net cards, trying to make the
authmsgwindow transparent
1 parent 81cfe20 commit 6ce7bcb

File tree

4 files changed

+24
-1
lines changed

4 files changed

+24
-1
lines changed

images/images.qrc

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<RCC>
22
<qresource prefix="/">
33
<file>warmth.png</file>
4+
<file>bg.png</file>
45
</qresource>
56
</RCC>

src/authmsgwindow.cpp

+18-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
***************************************************************************/
1919
#include <QTextCodec>
2020
#include <QApplication>
21+
#include <QDesktopWidget>
22+
#include <QPalette>
23+
#include <QBitmap>
2124

2225
#include "authmsgwindow.h"
2326
#include "mainwindow.h"
@@ -53,9 +56,23 @@ AuthMsgWindow::AuthMsgWindow(QWidget *parent)
5356
mainLayout->addWidget(authMsg);
5457
mainLayout->addLayout(buttons);
5558

56-
setLayout(mainLayout);
59+
//trying to set a transparent background image
60+
//setAutoFillBackground(true);
61+
//QPalette pal = this->palette();
62+
//pal.setBrush(QPalette::Background,QBrush(QPixmap(":/bg.png")));
63+
//setPalette(pal);
5764
setWindowTitle(tr("Authentication"));
65+
setWindowFlags(Qt::FramelessWindowHint); // not show the window frame
66+
//setMask(QPixmap(":/bg.png").mask());
67+
//setWindowOpacity(1);
68+
//setAttribute(Qt::WA_TranslucentBackground);
69+
//setObjectName("authmsgwindow");
70+
//setStyleSheet("#authmsgwindow{border-image:url(:/bg.png);}");
71+
setLayout(mainLayout);
72+
73+
// resize first and then it can be move to the center of the screen
5874
resize(374,200);
75+
move((QApplication::desktop()->width()-this->width())/2,(QApplication::desktop()->height()-this->height())/2);
5976

6077
connect(exitButton, SIGNAL(clicked()), this, SLOT(exitClicked()));
6178
connect(miniButton, SIGNAL(clicked()), this, SLOT(miniClicked()));

src/configwindow.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ ConfigWindow::ConfigWindow(QWidget *parent)
4949
//netCardSelect->setEditable(true);
5050
//QLineEdit *edit = netCardSelect->lineEdit();
5151

52+
//get active net card from system, it is a simple and stupid implementation,
53+
//it should be rewriten some day.
5254
getNetCard= new QProcess;
5355
getNetCard->start("/bin/ls -1 /proc/net/dev_snmp6");
5456
connect(getNetCard, SIGNAL(readyReadStandardOutput()), this, SLOT(showNetCards()));

src/mainwindow.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ void MainWindow::createAuthMW()
107107
connect(authMW, SIGNAL(destroyed()), this, SLOT(show()));
108108
connect(authMW, SIGNAL(destroyed()), this, SLOT(createAuthMW()));
109109

110+
//authMW->setObjectName("authmsgwindow");
111+
//authMW->setStyleSheet("#authmsgwindow{border-image:url(:/bg.png);}");
112+
110113
}
111114
void MainWindow::authClicked()
112115
{

0 commit comments

Comments
 (0)