
Originally Posted by
d_stranz
Because you are using a dark mode, I can't really see what the boundaries of your line edit are. Try adding a 1px white border to your style sheet so you can tell what is actually happening.
QLineEdit { border: 1px solid white }
To copy to clipboard, switch view to plain text mode
Sure - to recap, the code now looks like this:
MainWindow::MainWindow(CoreDictionary const& dict)
{
ui.setupUi(this);
ui.searchField->setAlignment(Qt::AlignVCenter | Qt::AlignRight);
ui.
searchField->setText
(QString("Type something here!"));
ui.searchField->setTextMargins(QMargins(0, 0, 0, 6));
ui.searchField->setStyleSheet("QLineEdit { padding: 0px 0px 0px 0px; border: 1px solid white;}");
}
MainWindow::MainWindow(CoreDictionary const& dict)
: QMainWindow(nullptr), dict{ dict }
{
ui.setupUi(this);
ui.searchField->setAlignment(Qt::AlignVCenter | Qt::AlignRight);
ui.searchField->setText(QString("Type something here!"));
ui.searchField->setTextMargins(QMargins(0, 0, 0, 6));
ui.searchField->setStyleSheet("QLineEdit { padding: 0px 0px 0px 0px; border: 1px solid white;}");
}
To copy to clipboard, switch view to plain text mode
And the result is this (side by side the version with bottom margin 0 and bottom margin 6):
Attachment 13851
Also a thing worth noticing is that the "g" bottom part is being clipped when the bottom margin is raised (right picture), with and without Qt::AlignVCenter which is another thing I find strange, because one would think the text has still room to be moved upward without clipping - but probably that issue is besides the point because probably I don't need to be messing with the margin to begin with (although I have no idea)
Bookmarks