qwidget

QWidget / X11: Prevent window from beeing activated/focussed by mouse clicks

帅比萌擦擦* 提交于 2020-01-13 10:53:48
问题 I would like to develop a system-wide onscreen keyboard in Qt/QML. Injecting key-events via xlib works fine. My problem now: If a keyboard-button is clicked, the window with the selected input field will lose the focus. In consequence, the key event will not be delivered to the previously selected input field. So does anybody know how to prevent a QWidget from beeing activated/focussed by mouse-clicks? Every hint is welcome and a code examples would be great! Thank you very much in advance,

QWidget / X11: Prevent window from beeing activated/focussed by mouse clicks

谁都会走 提交于 2020-01-13 10:53:28
问题 I would like to develop a system-wide onscreen keyboard in Qt/QML. Injecting key-events via xlib works fine. My problem now: If a keyboard-button is clicked, the window with the selected input field will lose the focus. In consequence, the key event will not be delivered to the previously selected input field. So does anybody know how to prevent a QWidget from beeing activated/focussed by mouse-clicks? Every hint is welcome and a code examples would be great! Thank you very much in advance,

QT insert widget inside an other widget

被刻印的时光 ゝ 提交于 2020-01-11 10:47:20
问题 I've created an UI with qt Creator,in this UI there is just a button and a widget (let's call it respectively button and char_container); I need to add a chartview programmatically inside the chart_container. I didn't change the default layout. I've tried the following code,but it does not work: void MainWindow::button_slot(){ QtCharts::QChart *chart = new QtCharts::QChart(); QtCharts::QChartView *chartView = new QtCharts::QChartView(chart); chartView->setParent(ui->chart_container); this

PyQt4: set size of QGridLayout depending on size of QMainWindow

有些话、适合烂在心里 提交于 2020-01-06 13:25:28
问题 I'm writing a little Qt application with Python. I've created QMainWindow, which have a QGridLayout. In each grid I'm adding QTextBrowser Widget. I want left side of my grid to be not bigger than 25% of window. So I'll have two QTextBrowsers: one is 25% of window's width, and another is 75% of window's width. How can I do it? Thanks! 回答1: You can specify relative width by giving each cell a stretch with setStretch(). They will get sizes proportional to the given stretches. Here is a simple

Does deleting layout deletes its sublayouts?

家住魔仙堡 提交于 2020-01-06 07:09:52
问题 I am working on Qt application. There I am creating layout and adding sublayout. I have seen that calling addLayout() sets as parent the container layout. Does that implies than when I delete superlayout its descendants will get deleted too? QWidget* centralWidget = new QWidget(this); QVBoxLayout *mainLayout = new QVBoxLayout(centralWidget); QFormLayout *formLayout = new QFormLayout; mainLayout->addLayout(formLayout); Will deleting centralWidget delete formLayout? Thanks and regards 回答1:

PyQt5, adding text to tabs doesn't work

試著忘記壹切 提交于 2020-01-05 23:27:57
问题 I am making an IDE in python and I've had some trouble adding text to my tabs. Adding the title works but adding the text inside of it doesn't. Here is my code: import sys import sys from subprocess import PIPE, Popen import json from pyautogui import hotkey from PyQt5 import QtGui, QtPrintSupport from PyQt5.QtCore import QRect, QRegExp, Qt from PyQt5.QtGui import (QColor, QFont, QPainter, QSyntaxHighlighter, QTextCharFormat, QTextCursor) from PyQt5.QtWidgets import (QAction, QApplication,

PyQt5, adding text to tabs doesn't work

蹲街弑〆低调 提交于 2020-01-05 23:25:40
问题 I am making an IDE in python and I've had some trouble adding text to my tabs. Adding the title works but adding the text inside of it doesn't. Here is my code: import sys import sys from subprocess import PIPE, Popen import json from pyautogui import hotkey from PyQt5 import QtGui, QtPrintSupport from PyQt5.QtCore import QRect, QRegExp, Qt from PyQt5.QtGui import (QColor, QFont, QPainter, QSyntaxHighlighter, QTextCharFormat, QTextCursor) from PyQt5.QtWidgets import (QAction, QApplication,

PyQt5, adding text to tabs doesn't work

随声附和 提交于 2020-01-05 23:25:24
问题 I am making an IDE in python and I've had some trouble adding text to my tabs. Adding the title works but adding the text inside of it doesn't. Here is my code: import sys import sys from subprocess import PIPE, Popen import json from pyautogui import hotkey from PyQt5 import QtGui, QtPrintSupport from PyQt5.QtCore import QRect, QRegExp, Qt from PyQt5.QtGui import (QColor, QFont, QPainter, QSyntaxHighlighter, QTextCharFormat, QTextCursor) from PyQt5.QtWidgets import (QAction, QApplication,

qt mouse event filter

天涯浪子 提交于 2020-01-05 16:48:33
问题 I have a QWidget with a QGraphicsView and a push button. The QGraphicsView has to take mouse press and release events to detect a swipe .At the same time push button should run a small function on clicked. I used an event filter in the QWidget to detect the mouse events. bool Widget::eventFilter(QObject * obj, QEvent * event) { // Capturing keyboard events for moving if( event->type() == QEvent::KeyPress ) { //Do something } //Capturing mouse events for swipe else if( event->type() == QEvent:

qt mouse event filter

杀马特。学长 韩版系。学妹 提交于 2020-01-05 16:48:08
问题 I have a QWidget with a QGraphicsView and a push button. The QGraphicsView has to take mouse press and release events to detect a swipe .At the same time push button should run a small function on clicked. I used an event filter in the QWidget to detect the mouse events. bool Widget::eventFilter(QObject * obj, QEvent * event) { // Capturing keyboard events for moving if( event->type() == QEvent::KeyPress ) { //Do something } //Capturing mouse events for swipe else if( event->type() == QEvent: