Hello,
I have a QLineEdit that I subclassed to add a lot of specific functionality for my app. To deal with alignment and style issues on my app, I need to have the active portion of the LineEdit occupy only a subset of the widget size, while still retaining all the properties and functionality of the new LineEdit.
Let me clarify: For a normal QLineEdit, the active portion (where you type) is the whole area of the widget. I need the right 1/4" to match the background. I know I could make a new widget and add a spacer to the right. Two problems with that are: (1) Even fixed-size spacers do not seem to hold their sizes, but will still expand and contract depending on their mood, regardless of size hints and size policy. (2) I need to access all the functionality of the widget directly -- properties and functions.
My thought was that if I use a subclass of QLineEdit and somehow only draw the lineEdit on the left leaving the right 1/4" free, that would do it. The paintEvent of my current QlineEdit calls "QLineEdit:: paintEvent(Event)" which will draw over the entire widget. How would I get QlineEdit to draw only on the part I want it to? The other problem is, how do I make the background match of the unpainted/unutilized portion.
Can anyone offer suggestions as to what would work here?
thank you,
Jay
Bookmarks