Solved Small QLineEdit
-
I am trying to make a Sudoku.I want to take the inputs using QLineEdit but i cant make the size to be small it is always too wide.How can I make the QLineEdits be as small as 1 digit??
-
You can use setFixedWidth(), but be careful about the font.Different systems can have different font styles and sizes, so if you want to go with a fixed size widget make sure the font is fixed too. Otherwise you can use QFontMetrics to get the width of a digit with your current font.
-
You can use setFixedWidth(), but be careful about the font.Different systems can have different font styles and sizes, so if you want to go with a fixed size widget make sure the font is fixed too. Otherwise you can use QFontMetrics to get the width of a digit with your current font.
-
Thanks it worked!.Exactly what i wanted.
-
I am trying to make a Sudoku.I want to take the inputs using QLineEdit
That would mean creating 81
QLineEdits
for a standard-sized Sudoku board. I'm not sure in Qt, but this may be regarded as bad practice? My thought (in your next iteration, for public release :) ) would be something like aQTableWidget
containing at worst aQLabel
or better just plain text without a widget most of the time, with a change over to editable (QLineEdit
or otherwise) at the instant user clicks into cell, revert back once clicked outside?