qt 相关问题

Qt是一个跨平台的应用程序开发框架,广泛用于开发应用程序软件,可以在各种软件和硬件平台上运行,底层代码库很少或没有变化,同时具有本机应用程序的功能和速度。 Qt提供商业和开源许可证。

QT创建者15.0在终端运行以进行适当的COUT和CIN功能

i遵循了以前关于CIN >>不起作用的答案中给出的所有说明,但我无法在QT Creator 15:

回答 1 投票 0

qt
回答 1 投票 0


如何进行多行Qt.binding()

我有一个简单的 QML 应用程序,其中有一个 Board(只是一个名为parentRect 的矩形)和其中一个较小的子矩形(名为childRect)。 我想做到这一点,每当

回答 1 投票 0

QT QML下拉列表,如html

简单的东西,但找不到。我想要一个带有几个选择的简单下拉选择框。像html一样 1 2 ... 简单的东西,但找不到。我想要一个带有几个选择的简单下拉选择框。像html <select> <option>1</option> <option>2</option> </select> QML的代码是什么? there是一个简单的例子,可以用作起点: import QtQuick 1.0 Rectangle { width:400; height: 400; Rectangle { id:comboBox property variant items: ["Item 1", "Item 2", "Item 3"] property alias selectedItem: chosenItemText.text; property alias selectedIndex: listView.currentIndex; signal comboClicked; width: 100; height: 30; z: 100; smooth:true; Rectangle { id:chosenItem radius:4; width:parent.width; height:comboBox.height; color: "lightsteelblue" smooth:true; Text { anchors.top: parent.top; anchors.left: parent.left; anchors.margins: 8; id:chosenItemText text:comboBox.items[0]; font.family: "Arial" font.pointSize: 14; smooth:true } MouseArea { anchors.fill: parent; onClicked: { comboBox.state = comboBox.state==="dropDown"?"":"dropDown" } } } Rectangle { id:dropDown width:comboBox.width; height:0; clip:true; radius:4; anchors.top: chosenItem.bottom; anchors.margins: 2; color: "lightgray" ListView { id:listView height:500; model: comboBox.items currentIndex: 0 delegate: Item{ width:comboBox.width; height: comboBox.height; Text { text: modelData anchors.top: parent.top; anchors.left: parent.left; anchors.margins: 5; } MouseArea { anchors.fill: parent; onClicked: { comboBox.state = "" var prevSelection = chosenItemText.text chosenItemText.text = modelData if(chosenItemText.text != prevSelection){ comboBox.comboClicked(); } listView.currentIndex = index; } } } } } Component { id: highlight Rectangle { width:comboBox.width; height:comboBox.height; color: "red"; radius: 4 } } states: State { name: "dropDown"; PropertyChanges { target: dropDown; height:40*comboBox.items.length } } transitions: Transition { NumberAnimation { target: dropDown; properties: "height"; easing.type: Easing.OutExpo; duration: 1000 } } } } 对于新用户,QT5.3Qtquick.controlscombobox-compore..中有一个内置ComboBox 文档中的示例: import QtQuick 2.2 import QtQuick.Controls 1.2 ComboBox { id: combo editable: true model: ListModel { id: model ListElement { text: "Banana"; color: "Yellow" } ListElement { text: "Apple"; color: "Green" } ListElement { text: "Coconut"; color: "Brown" } } onAccepted: { if (combo.find(currentText) === -1) { model.append({text: editText}) currentIndex = combo.find(editText) } } } 注:我不得不将其作为答案,因为文本要长时间发表评论。 我一直在使用ComboBoxStyle(自定义功能有限)和完全自定义实现的方法,但是它们在focus管理和管理方面有很多限制。 我最终以2部分组成的实现the的实现:您实际上放置在某个地方的标题和您动态创建的下拉组件。后者包括覆盖所有内容(和拦截鼠标活动)和一个小心位于标头下方的下拉列表组成。 代码非常庞大,可以在此处包含,因此您可以在我的博客文章中查看所有代码中的详细信息。 如果您针对诺基亚设备(Symbian或Meego),则可以使用高级QT快速组件。我相信z-index是类似于HTML的ComboBox。 请参见Http://doc.qt.nokia.com/qt-components-symbian/qml-menu.html或http://harmattan-dev.nokia.com/docs/docs/docs/docs/library/library/library/html/html/qt-ctml/qt-components /qt-components-meego-menu.html 如果您针对Symbian,则有SelectionListItem和SelectionDialog: http://doc.qt.nokia.com/qt-components-symbian/qml-selectionlistitem.html

回答 0 投票 0

如何通过调整窗口大小来扩展小部件?

I在主窗口内有一个简单的QT应用程序,该应用程序带有QTABWIDGET。我也有一些Qpushbutton(S)和Qradiobutton(S)。 我想要的是,当我手动或通过

回答 1 投票 0


如何对 ListView 页脚的内容应用特定边距

我使用页脚属性将按钮放置在其上,但是当我尝试设置左边距以将其与左按钮相同的列对齐时,我没有得到任何结果。 当我尝试时,我遇到了同样的问题...

回答 2 投票 0

访问ListView页眉和页脚项目以获取当前委托实例

我想以类似于调用 currentItem 来获取当前委托实例的方式访问 QML ListView 中的页眉和页脚项。 我该怎么做?

回答 2 投票 0

QML ListView 页眉和页脚项目?

我想以类似于调用 currentItem 来获取当前委托实例的方式访问 QML ListView 中的页眉和页脚项目,但我不知道如何实现。我将不胜感激任何建议。

回答 2 投票 0

QT6:如何从不同线程发出的事件循环过程信号?

plapsose您拥有生活在主线程中的A类,B和C类。 A类和B类连接到C的状态法(BOOL)信号。 C从外部线触发以发射信号。考虑...

回答 1 投票 0

cuda-opengl Interops线程安全

/ *这是在第二个线程上执行的 */ 静态void do_progressive_render_gpu(){ 对于(示例s = 0; s< SOMEVALUE ; s++){ updateMeshBuffersPtrs(); //Calls cudaGraphicsResourceGetMappedPointer()

回答 1 投票 0

qDebug 控制台输出带时间戳

我写了一个qt小型控制台实用程序来测试数据库连接,代码块是: db.setHostName("主机IP"); db.setDatabaseName("名称"); db.setUserName("uid"); db.setPassword("密码...

回答 3 投票 0

QException 的目的是什么?

在 Qt 5.0 中 - Qt 引入了 QException 类。 继承这个类有什么好处?如果我们抛出一个不是从 QException 类继承的类怎么办? 预先感谢您!

回答 1 投票 0

如何为 QPushButton 分配快捷方式?

为 QPushButton 分配快捷方式的文档如下: 可以通过在文本中在首选字符前加上 & 符号来指定快捷键。例如: QPush但是...

回答 4 投票 0

QML - 使用 WorkerScript 加载繁重的 StackView 组件

我使用Python作为后端制作了一个简单的QML项目。我的目标是当我的主 StackView 正忙于加载重型组件时显示 BusyIndicator,但我有一个问题。当我加载这个组件时,...

回答 1 投票 0

如何配置 QT 5.15.16 以使用 C++20 而不是 С++17?

我尝试将 C++20 与 Qt 一起使用,但无论我做什么,它总是默认为 C++17。 以下是配置后输出的相关部分: # 头配置.summary 构建类型:linux-g++(x86...

回答 1 投票 0

macOS 上安装 PySide6 后 Qt 工具在哪里?

在Windows上运行pip3 install pyside6后,我们可以看到PySide6下有很多Qt工具。 在 macOS 上安装 PySide6 后这些工具在哪里? 搜索没有结果。 请告诉我什么...

回答 1 投票 0

Qt 应用程序标题

我正在开发一个Qt应用程序 我设法使用 methode 设置主窗口标题 setWindowTitle("我的标题"); 然而,这会更改应用程序顶部栏中的名称,但不会影响...

回答 4 投票 0

QML 文本中的 HTML 格式

我有一部分HTML代码,它显示小表格。在浏览器中,如图所示: 但是当我想在 Text QML 中显示它时(根据文档,它应该支持 HT...

回答 1 投票 0

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.