小编Bra*_*ark的帖子

QLineEdit可见宽度设置?

如何使用Qt 4.8.1及更高版本设置QLineEdit的可见宽度.示例是将可见宽度设置为某个像素大小或字符宽度.我希望只使用C++而不是QML.

我的想法是在这个块的方向:

QHBoxLayout *nameRow = new QHBoxLayout; 

QLineEdit   *firstNameText = new QLineEdit,
            *middleIntText = new QLineEdit,
            *lastNameText = new QLineEdit;
//Whatever method is needed here to edit visible width
//firstNameText->???
//middleIntText->???
//lastNameText->???

nameRow->addWidget(firstNameText);
nameRow->addWidget(middleIntText);
nameRow->addWidget(lastNameText);

layout->addLayout(nameRow);

QWidget window;
window.setLayout(layout);
window.show();
Run Code Online (Sandbox Code Playgroud)

答案更新:(或见下文)

firstNameText->setMaximumWidth(100);
firstNameText->setFixedWidth(120);

middleIntText->setMaximumWidth(50);
middleIntText->setFixedWidth(60);

lastNameText->setMaximumWidth(100);
lastNameText->setFixedWidth(120);
Run Code Online (Sandbox Code Playgroud)

c++ user-interface qt

12
推荐指数
1
解决办法
1万
查看次数

Qt全局样式表加载?

如何使用Qt全局加载样式表(.qss样式资源)?

我试图让事情比以下更有效:

middleIntText -> setStyleSheet("QLineEdit {  border: 1px solid gray;
                                border-radius: 5px;padding: 0 8px;
                                selection-background-color:darkgray;
                                height:40px;font-size:15px;}");
Run Code Online (Sandbox Code Playgroud)

我认为以下内容适用于所有QLineEdit小部件的一次加载QLineEdit:

qss文件:

QLineEdit {     border: 1px solid gray;
                border-radius: 5px;
                padding: 0 8px;
                selection-background-color:darkgray;
                height:40px;
                font-size:15px;}
Run Code Online (Sandbox Code Playgroud)

cpp文件:

QApplication a(argc, argv);
QFile stylesheet("formStyle.qss");
stylesheet.open(QFile::ReadOnly);
QString setSheet = QLatin1String(stylesheet.readAll());
a.setStyleSheet(setSheet);
Run Code Online (Sandbox Code Playgroud)

也许这是对的,我做错了什么?

c++ qt qtstylesheets

8
推荐指数
1
解决办法
6151
查看次数

QLineEdit圆角?

有没有办法绕过QLineEdit小部件的角落?如果不是有类似的小部件,我可以做到这一点?

视觉意义:

在此输入图像描述

解决:(请参见下面的其他信息)

      QLineEdit *lineEdit = new QLineEdit;

      lineEdit -> setStyleSheet("QLineEdit {  border: 2px solid gray;"
                                             "border-radius: 5px;}");
Run Code Online (Sandbox Code Playgroud)

c++ user-interface qt

6
推荐指数
2
解决办法
3921
查看次数

为Grub 2引导加载程序增加触摸灵敏度?

我想知道Ubuntu 13.04中存在哪些库允许与Grub2集成以及它的更多细节(即语言,开发阶段,开发人员等),或者如果不能这样做,为什么?

我还认为可以在Surface Pro架构中使用本机设备代码,但是没有如何开始的经验.如果有可能请告诉我!


编辑: 2013年3月14日@太平洋标准时间下午5:40

我一直在努力寻找并在Ubuntu 13.04下找到以下软件包:

ubuntu integrate touch bootloader

3
推荐指数
1
解决办法
5181
查看次数

标签 统计

c++ ×3

qt ×3

user-interface ×2

bootloader ×1

integrate ×1

qtstylesheets ×1

touch ×1

ubuntu ×1