【问题标题】:QCommandLinkButton text and icon position style with QSS带有 QSS 的 QCommandLinkBut​​ton 文本和图标位置样式
【发布时间】:2014-10-12 15:51:11
【问题描述】:

我想使用QSS 自定义QCommandLinkButton,并且我想自定义小部件的图标位置和文本位置。这可能吗?我在网上或QSS Reference Documentation 上找不到任何东西,尽管可以设置小部件的样式。我尝试了widthheight 属性,它们确实有效。我认为QPushButton 上的所有属性也适用于QCommandLinkButton,因为QCommandLinkButton 继承QPushButton

我试过了

QCommandLinkButton::text {
    left: 10px;
}


QCommandLinkButton::icon {
    left: 10px;
}

但没有效果。

有什么想法吗?

【问题讨论】:

    标签: qt qpushbutton qtstylesheets


    【解决方案1】:

    这还不可能(从 Qt 5.3.1 开始)。 为了实现这一点,您必须派生类并重新实现paintEvent。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-04-10
      • 1970-01-01
      • 2013-01-18
      • 2016-06-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-12-29
      相关资源
      最近更新 更多