PDA

View Full Version : Status bar(widget frame) problem



vuletic
27th March 2015, 18:51
Hello, I'm having problem removing frame of QLabel widget:

http://i.imgur.com/TA0hoSR.png ( on far right side of status bar)

I tried setFrameShape(QtWidgets.QFrame.NoFrame), and with stylesheets (border-width: 0px) or just (border: x), without success.

Edit: And is there a way to get text cursor current line postion( like this .textCursor().positionInBlock() for column)?

wysota
28th March 2015, 07:33
The frame comes from the status bar and not QLabel. You will not be able to remove it easily.

As for your second question, QTextCursor::blockNumber() contains the line number of the cursor.

vuletic
28th March 2015, 11:06
I thought it was something like that, but I still would like to remove it, but I would need to know where to start looking first, if you/anyone else have any ideas where I could start working on that, please tell :D

wysota
29th March 2015, 22:50
paintEvent of QStatusBar would be a good place to start looking.

vuletic
30th March 2015, 19:12
After better google search than last one :D, I found easy fix for this:

adding app.setStyleSheet("QStatusBar::item { border: 0px solid black }; "); after app = QtWidgets.QApplication(sys.argv) fixed my problem, for anyone else wondering how to do this.

Here is link how it looks now: http://i.imgur.com/yqyFZzU.png

Edit: or just self.setStyleSheet("QStatusBar::item { border: 0px };") in setupUi

wysota
30th March 2015, 19:33
You should move the items up a bit. They are not vertically centered.

vuletic
30th March 2015, 19:54
'QStatusBar' object has no attribute 'setAlignment', so I tried to align only widgets on it:

self.statusbarLocationLabel.setAlignment(QtCore.Qt .AlignVCenter) etc, but I don't think it works, look:

old one:
http://i.imgur.com/yqyFZzU.png
new one:
http://i.imgur.com/QAljYAM.png

wysota
30th March 2015, 19:55
If you are using stylesheets then maybe you can use them for that.

vuletic
30th March 2015, 20:04
Indeed :P