qt

DropArea doesn't notify about actions onEntered, onExited, onDropped

假装没事ソ 提交于 2021-02-08 06:33:27
问题 I have Rectangle filled with MouseArea which on onPressAndHold() handler reveals second Rectangle and transfers drag action to that Rectangle . The problem is that when I move that second Rectangle over DropArea it doesn't notify about any actions ( onEntered , onExited , onDropped ). I tried to do this in many combinations but it has never worked. Here is an example, am I missing something? import QtQuick 2.0 import QtQuick.Window 2.0 Window { id: appDrawerRoot visible: true width: 360;

DropArea doesn't notify about actions onEntered, onExited, onDropped

微笑、不失礼 提交于 2021-02-08 06:33:24
问题 I have Rectangle filled with MouseArea which on onPressAndHold() handler reveals second Rectangle and transfers drag action to that Rectangle . The problem is that when I move that second Rectangle over DropArea it doesn't notify about any actions ( onEntered , onExited , onDropped ). I tried to do this in many combinations but it has never worked. Here is an example, am I missing something? import QtQuick 2.0 import QtQuick.Window 2.0 Window { id: appDrawerRoot visible: true width: 360;

Open PDF at specific page with Qt WebEngineView

隐身守侯 提交于 2021-02-08 05:57:35
问题 I want to create a simple PDF Viewer inside my Qt Application. Everything works fine, accept opening the PDF at a specific page over the URL. For example: url = "file:///D://Repo//PdfViewer//PdfViewer//test.pdf"; Works, but url = "file:///D://Repo//PdfViewer//PdfViewer//test.pdf#page=9"; dosent. I read somewhere, that chrome dosent offically support #page=x anymore, but I cant find futher information how to solve this. I face the same problem with this url in the Nano-Browser Example from Qt.

Making QGraphicsScene bigger when a graphic item is placed against its border

▼魔方 西西 提交于 2021-02-08 05:19:22
问题 I've made a QGraphicsScene with a mouseClickEvent that lets the user create blue squares inside of it. But I want to make the scene grow when an item is placed against its border so that the user never runs out of space on the graphics scene. What's the best way to make a graphics scene bigger in this case? 回答1: I suggest doing something like the following: Get the bounding rect of all items in the scene using QGraphicsScene::itemsBoundingRect() . Add some padding around that rect to make

Making QGraphicsScene bigger when a graphic item is placed against its border

折月煮酒 提交于 2021-02-08 05:17:48
问题 I've made a QGraphicsScene with a mouseClickEvent that lets the user create blue squares inside of it. But I want to make the scene grow when an item is placed against its border so that the user never runs out of space on the graphics scene. What's the best way to make a graphics scene bigger in this case? 回答1: I suggest doing something like the following: Get the bounding rect of all items in the scene using QGraphicsScene::itemsBoundingRect() . Add some padding around that rect to make

Making QGraphicsScene bigger when a graphic item is placed against its border

喜你入骨 提交于 2021-02-08 05:17:47
问题 I've made a QGraphicsScene with a mouseClickEvent that lets the user create blue squares inside of it. But I want to make the scene grow when an item is placed against its border so that the user never runs out of space on the graphics scene. What's the best way to make a graphics scene bigger in this case? 回答1: I suggest doing something like the following: Get the bounding rect of all items in the scene using QGraphicsScene::itemsBoundingRect() . Add some padding around that rect to make

How to stop spacebar from triggering a focused QPushButton?

纵然是瞬间 提交于 2021-02-08 05:02:04
问题 Suppose I have a focused QPushButton : my_button = new QPushButton("Press me!", this); my_button->setFocus(); When this button is displayed, pressing Space will trigger (i.e. click) the button. I don't want this behavior. Instead, I would like Ctrl + Enter to trigger the button. How can I achieve this in Qt? (Working examples would really help as this is part of my first Qt app) 回答1: I think the best way is to do as @thuga said. The idea is to subclass the QPushButton and reimplement

How to stop spacebar from triggering a focused QPushButton?

十年热恋 提交于 2021-02-08 05:01:59
问题 Suppose I have a focused QPushButton : my_button = new QPushButton("Press me!", this); my_button->setFocus(); When this button is displayed, pressing Space will trigger (i.e. click) the button. I don't want this behavior. Instead, I would like Ctrl + Enter to trigger the button. How can I achieve this in Qt? (Working examples would really help as this is part of my first Qt app) 回答1: I think the best way is to do as @thuga said. The idea is to subclass the QPushButton and reimplement

How to get the android keyboard to appear when using Qt For Android?

你说的曾经没有我的故事 提交于 2021-02-08 04:47:34
问题 I've created a minimal working example of an Input box I'd like to develop using a QGraphicsItem. Here is the code (I'd figure the .h is not necessary): TestEditor::TestEditor() { text = ""; boundingBox = QRectF(0,0,200,100); } QRectF TestEditor::boundingRect() const{ return boundingBox; } void TestEditor::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget){ painter->setBrush(QBrush(Qt::gray)); painter->drawRect(boundingBox); painter->setBrush(QBrush(Qt::black));

How to set initial value of a custom slider in qml?

≯℡__Kan透↙ 提交于 2021-02-08 04:08:19
问题 I am using Qt 5.4.1. I have made a custom slider element to be used in other qml components like so: Slider.qml import QtQuick 2.4 import QtQuick.Controls 1.3 import QtQuick.Controls.Styles 1.3 Item { id: root width: 150 height: 30 property int val: slider.value property int maxVal: slider.maximumValue property int minVal: slider.minimumValue property int step: slider.stepSize Slider { id: slider anchors.margins: 20 stepSize: step maximumValue: maxVal minimumValue: minVal style: customStyle /