Ok.
This is my main.cpp:
int main(int argc, char *argv[])
{
Widget w;
w.show();
return a.exec();
}
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Widget w;
w.show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
This is Widget class .cpp:
#include <QtGUI>
#include "ui_widget.h"
#include "clock.h"
: QWidget(parent
), ui
(new Ui
::Clock) {
ui->setupUi(this);
Clock c;
c.show();
}
Widget::~Widget()
{
delete ui;
}
Widget::Widget(QWidget *parent)
: QWidget(parent), ui(new Ui::Clock)
{
ui->setupUi(this);
Clock c;
c.show();
}
Widget::~Widget()
{
delete ui;
}
To copy to clipboard, switch view to plain text mode
And here is clock.cpp
{
setWindowFlags(Qt::FramelessWindowHint);
setWindowFlags(Qt::Tool | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
setStyleSheet("background: transparent; border: none");
this->setAttribute(Qt::WA_TranslucentBackground);
this->setAttribute(Qt::WA_TransparentForMouseEvents);
}
Clock::Clock(QWidget *parent)
: QGraphicsView(parent)
{
setWindowFlags(Qt::FramelessWindowHint);
setWindowFlags(Qt::Tool | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
setStyleSheet("background: transparent; border: none");
this->setAttribute(Qt::WA_TranslucentBackground);
this->setAttribute(Qt::WA_TransparentForMouseEvents);
}
To copy to clipboard, switch view to plain text mode
I didn't post the whole files, but if needed no prob.
Bookmarks