0

i want to hide those borders

.

and make it look like this

I foud that creating a nice GUI with QT is very hard, so i had the idea of designing one as a PNG backround an putting a transparent object on it,so my question is how do I hide the borders of the lineEdits an Buttons in QT

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
Nidal El
  • 1
  • 4

1 Answers1

3

A possible solution is to use Qt Style Sheets through the property

border-radius: some_value;

Example:

#include <QApplication>
#include <QLineEdit>
#include <QPushButton>
#include <QVBoxLayout>
#include <QWidget>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    QString qss = "QWidget{"
                       "background-color: rgb(92, 53, 102);"
                       "}"
                       "QPushButton{"
                       "border-radius: 10px;"
                       "background-color: rgb(85, 87, 83);"
                       "}"
                       "QPushButton:pressed{"
                       " border-radius: 10px;"
                       "background-color: rgb(46, 52, 54);"
                       "}"
                       "QLineEdit {"
                       "border-radius: 10px;"
                       "background-color: rgb(173, 127, 168);"
                       "}";

    a.setStyleSheet(qss);
    QWidget widget;
    widget.setLayout(new QVBoxLayout);
    widget.layout()->addWidget(new QPushButton("button"));
    widget.layout()->addWidget(new QLineEdit);
    widget.show();
    return a.exec();
}

Output:

enter image description here

References:

eyllanesc
  • 235,170
  • 19
  • 170
  • 241