MainWindow
::MainWindow(int argc,
char** argv,
QWidget *parent
) , qnode(argc,argv)
{
//Transparent
setWindowFlags(Qt::Widget | Qt::FramelessWindowHint);
setParent(0); // Create TopLevel-Widget
setAttribute(Qt::WA_NoSystemBackground, true);
setAttribute(Qt::WA_TranslucentBackground, true);
ui.setupUi(this); // Calling this incidentally connects all ui's triggers to on_...() callbacks in this class.
setWindowIcon
(QIcon(":/images/icon.png"));
QObject::connect(&qnode,
SIGNAL(rosShutdown
()),
this,
SLOT(close
()));
//buttons
ButtonBackground
(ui.
up_button,
QPixmap("/home/yrj/manny/src/jmr_qt/resources/images/up_up.png"));
ButtonBackground
(ui.
down_button,
QPixmap("/home/yrj/manny/src/jmr_qt/resources/images/down_up.png"));
ButtonBackground
(ui.
left_button,
QPixmap("/home/yrj/manny/src/jmr_qt/resources/images/left_up.png"));
ButtonBackground
(ui.
right_button,
QPixmap("/home/yrj/manny/src/jmr_qt/resources/images/right_up.png"));
ButtonBackground
(ui.
stop_button,
QPixmap("/home/yrj/manny/src/jmr_qt/resources/images/stop.png"));
ButtonBackground
(ui.
exit_button,
QPixmap("/home/yrj/manny/src/jmr_qt/resources/images/exit.png"));
{
//Bitmap
int width = button->size().width();
int height = button->size().height();
QIcon ButtonIcon
(pixmap
);
button->setFlat(true);
button->setStyleSheet("background-color: transparent;");
button->setIcon(ButtonIcon);
button
->setIconSize
(QSize(width, height
));
}
MainWindow::MainWindow(int argc, char** argv, QWidget *parent)
: QMainWindow(parent)
, qnode(argc,argv)
{
//Transparent
setWindowFlags(Qt::Widget | Qt::FramelessWindowHint);
setParent(0); // Create TopLevel-Widget
setAttribute(Qt::WA_NoSystemBackground, true);
setAttribute(Qt::WA_TranslucentBackground, true);
ui.setupUi(this); // Calling this incidentally connects all ui's triggers to on_...() callbacks in this class.
setWindowIcon(QIcon(":/images/icon.png"));
QObject::connect(&qnode, SIGNAL(rosShutdown()), this, SLOT(close()));
//buttons
ButtonBackground(ui.up_button, QPixmap("/home/yrj/manny/src/jmr_qt/resources/images/up_up.png"));
ButtonBackground(ui.down_button, QPixmap("/home/yrj/manny/src/jmr_qt/resources/images/down_up.png"));
ButtonBackground(ui.left_button, QPixmap("/home/yrj/manny/src/jmr_qt/resources/images/left_up.png"));
ButtonBackground(ui.right_button, QPixmap("/home/yrj/manny/src/jmr_qt/resources/images/right_up.png"));
ButtonBackground(ui.stop_button, QPixmap("/home/yrj/manny/src/jmr_qt/resources/images/stop.png"));
ButtonBackground(ui.exit_button, QPixmap("/home/yrj/manny/src/jmr_qt/resources/images/exit.png"));
void MainWindow::ButtonBackground(QPushButton *button, QPixmap pixmap)
{
//Bitmap
int width = button->size().width();
int height = button->size().height();
QIcon ButtonIcon(pixmap);
button->setFlat(true);
button->setStyleSheet("background-color: transparent;");
button->setIcon(ButtonIcon);
button->setIconSize(QSize(width, height));
}
To copy to clipboard, switch view to plain text mode
Bookmarks