Why does font change size when I shrink QTableWidget column2019 Community Moderator ElectionHow do you change the size of figures drawn with matplotlib?Why does comparing strings using either '==' or 'is' sometimes produce a different result?How to change the font size on a matplotlib plotWhy does Python code run faster in a function?How to change the order of DataFrame columns?Change data type of columns in PandasPython PyQt4 QTableWidget CellWidget Roll Column valuessort a column with setCellWidget in QTableWidgetPyQt4 QTableWidget: Set row width and column height to fill parent widgetQTableWidget - Change the row color
Brexit - No Deal Rejection
Are all passive ability checks floors for active ability checks?
How to write cleanly even if my character uses expletive language?
Do I need to be arrogant to get ahead?
Recruiter wants very extensive technical details about all of my previous work
Employee lack of ownership
Why do tuner card drivers fail to build after kernel update to 4.4.0-143-generic?
Bacteria contamination inside a thermos bottle
PTIJ: Who should I vote for? (21st Knesset Edition)
Different outputs for `w`, `who`, `whoami` and `id`
Could the Saturn V actually have launched astronauts around Venus?
Is there a hypothetical scenario that would make Earth uninhabitable for humans, but not for (the majority of) other animals?
Is "upgrade" the right word to use in this context?
Have the tides ever turned twice on any open problem?
Knife as defense against stray dogs
How are passwords stolen from companies if they only store hashes?
I got the following comment from a reputed math journal. What does it mean?
Explaining pyrokinesis powers
Custom alignment for GeoMarkers
Math equation in non italic font
New passport but visa is in old (lost) passport
How to explain that I do not want to visit a country due to personal safety concern?
A diagram about partial derivatives of f(x,y)
Is it insecure to send a password in a `curl` command?
Why does font change size when I shrink QTableWidget column
2019 Community Moderator ElectionHow do you change the size of figures drawn with matplotlib?Why does comparing strings using either '==' or 'is' sometimes produce a different result?How to change the font size on a matplotlib plotWhy does Python code run faster in a function?How to change the order of DataFrame columns?Change data type of columns in PandasPython PyQt4 QTableWidget CellWidget Roll Column valuessort a column with setCellWidget in QTableWidgetPyQt4 QTableWidget: Set row width and column height to fill parent widgetQTableWidget - Change the row color
I have a simple Python application with a PyQt QTableWidget with multiple columns and rows. If the user resizes a column to a size that is just smaller than the cell can hold.. the font of the cell will shrink by about 1 point in size (see animated GIF below). I have fiddled with almost every QTableWidget setting in QtDesigner. I would like the font size to remain consistent regardless.
What is causing this and how can I prevent it?
Update:
In my __main__
section, I create a stylesheet for buttons.
I apply this style sheet using setStyleSheet.
If I comment-out setStyleSheet, the problem goes away.
Adding QTableWidgetfont: 9pt "Segoe UI";
also fixes, but I'd rather not do that.
Why is this stylesheet causing this?
if __name__ == "__main__":
app = QtGui.QApplication(sys.argv)
stylesheet = """
QPushButton:hover, QComboBox:hover
background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #cbc9c5, stop: 1 #b9b7b5);
border: 2px solid #78879b;
border-radius: 3px;
"""
app.setStyleSheet(stylesheet)
myapp = MyProgram() # instantiate the main window
myapp.show() # show the main window
rc = app.exec_()
myapp.close()
sys.exit(rc) # exit with the same return code of Qt application
python pyqt pyqt4 qtablewidget
|
show 1 more comment
I have a simple Python application with a PyQt QTableWidget with multiple columns and rows. If the user resizes a column to a size that is just smaller than the cell can hold.. the font of the cell will shrink by about 1 point in size (see animated GIF below). I have fiddled with almost every QTableWidget setting in QtDesigner. I would like the font size to remain consistent regardless.
What is causing this and how can I prevent it?
Update:
In my __main__
section, I create a stylesheet for buttons.
I apply this style sheet using setStyleSheet.
If I comment-out setStyleSheet, the problem goes away.
Adding QTableWidgetfont: 9pt "Segoe UI";
also fixes, but I'd rather not do that.
Why is this stylesheet causing this?
if __name__ == "__main__":
app = QtGui.QApplication(sys.argv)
stylesheet = """
QPushButton:hover, QComboBox:hover
background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #cbc9c5, stop: 1 #b9b7b5);
border: 2px solid #78879b;
border-radius: 3px;
"""
app.setStyleSheet(stylesheet)
myapp = MyProgram() # instantiate the main window
myapp.show() # show the main window
rc = app.exec_()
myapp.close()
sys.exit(rc) # exit with the same return code of Qt application
python pyqt pyqt4 qtablewidget
2
Please provide a Minimal, Complete, and Verifiable example that can be used to reproduce the problem.
– G.M.
Mar 6 at 21:25
My QTableWidget shows PyQt4.QtGui.QCommonStyle
– panofish
Mar 6 at 21:55
@panofish no, what is the output of the command that I have indicated:print(QtGui.QApplication.style().objectName())
?
– eyllanesc
Mar 7 at 1:40
Sorry @eyllanesc AttributeError: 'NoneType' object has no attribute 'objectName'
– panofish
Mar 7 at 5:42
@panofish You have to execute it afterapp = QtGui.QApplication(sys.argv)
– eyllanesc
Mar 7 at 5:45
|
show 1 more comment
I have a simple Python application with a PyQt QTableWidget with multiple columns and rows. If the user resizes a column to a size that is just smaller than the cell can hold.. the font of the cell will shrink by about 1 point in size (see animated GIF below). I have fiddled with almost every QTableWidget setting in QtDesigner. I would like the font size to remain consistent regardless.
What is causing this and how can I prevent it?
Update:
In my __main__
section, I create a stylesheet for buttons.
I apply this style sheet using setStyleSheet.
If I comment-out setStyleSheet, the problem goes away.
Adding QTableWidgetfont: 9pt "Segoe UI";
also fixes, but I'd rather not do that.
Why is this stylesheet causing this?
if __name__ == "__main__":
app = QtGui.QApplication(sys.argv)
stylesheet = """
QPushButton:hover, QComboBox:hover
background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #cbc9c5, stop: 1 #b9b7b5);
border: 2px solid #78879b;
border-radius: 3px;
"""
app.setStyleSheet(stylesheet)
myapp = MyProgram() # instantiate the main window
myapp.show() # show the main window
rc = app.exec_()
myapp.close()
sys.exit(rc) # exit with the same return code of Qt application
python pyqt pyqt4 qtablewidget
I have a simple Python application with a PyQt QTableWidget with multiple columns and rows. If the user resizes a column to a size that is just smaller than the cell can hold.. the font of the cell will shrink by about 1 point in size (see animated GIF below). I have fiddled with almost every QTableWidget setting in QtDesigner. I would like the font size to remain consistent regardless.
What is causing this and how can I prevent it?
Update:
In my __main__
section, I create a stylesheet for buttons.
I apply this style sheet using setStyleSheet.
If I comment-out setStyleSheet, the problem goes away.
Adding QTableWidgetfont: 9pt "Segoe UI";
also fixes, but I'd rather not do that.
Why is this stylesheet causing this?
if __name__ == "__main__":
app = QtGui.QApplication(sys.argv)
stylesheet = """
QPushButton:hover, QComboBox:hover
background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #cbc9c5, stop: 1 #b9b7b5);
border: 2px solid #78879b;
border-radius: 3px;
"""
app.setStyleSheet(stylesheet)
myapp = MyProgram() # instantiate the main window
myapp.show() # show the main window
rc = app.exec_()
myapp.close()
sys.exit(rc) # exit with the same return code of Qt application
python pyqt pyqt4 qtablewidget
python pyqt pyqt4 qtablewidget
edited Mar 7 at 1:41
eyllanesc
82.6k103360
82.6k103360
asked Mar 6 at 20:56
panofishpanofish
3,23563769
3,23563769
2
Please provide a Minimal, Complete, and Verifiable example that can be used to reproduce the problem.
– G.M.
Mar 6 at 21:25
My QTableWidget shows PyQt4.QtGui.QCommonStyle
– panofish
Mar 6 at 21:55
@panofish no, what is the output of the command that I have indicated:print(QtGui.QApplication.style().objectName())
?
– eyllanesc
Mar 7 at 1:40
Sorry @eyllanesc AttributeError: 'NoneType' object has no attribute 'objectName'
– panofish
Mar 7 at 5:42
@panofish You have to execute it afterapp = QtGui.QApplication(sys.argv)
– eyllanesc
Mar 7 at 5:45
|
show 1 more comment
2
Please provide a Minimal, Complete, and Verifiable example that can be used to reproduce the problem.
– G.M.
Mar 6 at 21:25
My QTableWidget shows PyQt4.QtGui.QCommonStyle
– panofish
Mar 6 at 21:55
@panofish no, what is the output of the command that I have indicated:print(QtGui.QApplication.style().objectName())
?
– eyllanesc
Mar 7 at 1:40
Sorry @eyllanesc AttributeError: 'NoneType' object has no attribute 'objectName'
– panofish
Mar 7 at 5:42
@panofish You have to execute it afterapp = QtGui.QApplication(sys.argv)
– eyllanesc
Mar 7 at 5:45
2
2
Please provide a Minimal, Complete, and Verifiable example that can be used to reproduce the problem.
– G.M.
Mar 6 at 21:25
Please provide a Minimal, Complete, and Verifiable example that can be used to reproduce the problem.
– G.M.
Mar 6 at 21:25
My QTableWidget shows PyQt4.QtGui.QCommonStyle
– panofish
Mar 6 at 21:55
My QTableWidget shows PyQt4.QtGui.QCommonStyle
– panofish
Mar 6 at 21:55
@panofish no, what is the output of the command that I have indicated:
print(QtGui.QApplication.style().objectName())
?– eyllanesc
Mar 7 at 1:40
@panofish no, what is the output of the command that I have indicated:
print(QtGui.QApplication.style().objectName())
?– eyllanesc
Mar 7 at 1:40
Sorry @eyllanesc AttributeError: 'NoneType' object has no attribute 'objectName'
– panofish
Mar 7 at 5:42
Sorry @eyllanesc AttributeError: 'NoneType' object has no attribute 'objectName'
– panofish
Mar 7 at 5:42
@panofish You have to execute it after
app = QtGui.QApplication(sys.argv)
– eyllanesc
Mar 7 at 5:45
@panofish You have to execute it after
app = QtGui.QApplication(sys.argv)
– eyllanesc
Mar 7 at 5:45
|
show 1 more comment
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55031995%2fwhy-does-font-change-size-when-i-shrink-qtablewidget-column%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55031995%2fwhy-does-font-change-size-when-i-shrink-qtablewidget-column%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
Please provide a Minimal, Complete, and Verifiable example that can be used to reproduce the problem.
– G.M.
Mar 6 at 21:25
My QTableWidget shows PyQt4.QtGui.QCommonStyle
– panofish
Mar 6 at 21:55
@panofish no, what is the output of the command that I have indicated:
print(QtGui.QApplication.style().objectName())
?– eyllanesc
Mar 7 at 1:40
Sorry @eyllanesc AttributeError: 'NoneType' object has no attribute 'objectName'
– panofish
Mar 7 at 5:42
@panofish You have to execute it after
app = QtGui.QApplication(sys.argv)
– eyllanesc
Mar 7 at 5:45