pyside

Assign string to QLineEdit with PySide/PyQt

老子叫甜甜 提交于 2020-01-11 14:49:08
问题 I'm having a little bit of trouble assigning values to a QLineEdit. I've read the documentation and feel that the QLineEdit.SetText() command will be used at some point. I've used Qt Designer to design a GUI for my software. On the main window (MainWindow.py, with an accompanying ui_MainWindow.py setup file), I have a LineEdit (lineEditScanBarcode) which has strong focus. I've managed to pull input from that LineEdit pretty well. What I'd like to do is this: If the input in

PySide: Returning a value from a slot

心已入冬 提交于 2020-01-11 09:35:15
问题 The Pyside documentation states that slots can have return values, but I have yet to figure out how make it do so. I couldn't find any usable code samples on this, so I've added a decorator as the docs suggest: def testSlot(self): print('testSlot called') return 'RETURN VALUE RETURN VALUE RETURN VALUE' And I'm trying to capture the return value like this: ret = foo.testSignal.emit() But it's not working. My test code, which you can find here, also crashes with this error output. Help is

QTreeWidget expand animation on double click

╄→гoц情女王★ 提交于 2020-01-11 09:18:25
问题 I have created a QTreeWidget and set animation to true ( setAnimated(true) ). When I'm clicking on a mark (triangle) at the left of item it expands smoothly, but when I'm double clicking on the item it expands too fast (almost like there is no "animated" flag set). I want smooth animation on double click too. How can I solve this problem? QTreeView calls QTreeViewPrivate::expandOrCollapseItemAtPos on mark click and QTreeViewPrivate::expand on double click, so I have no access to these methods

PDF with QWebView: missing refresh/repaint after loading

匆匆过客 提交于 2020-01-11 07:17:19
问题 I use the QWebView (python 3.3 + pyside 1.1.2 + Qt 4.8) as FileViewer. Picture, Text, HTML, ... all fine, but PDF has a display problem. I tested two possible ways. internal pdf viewer: after use webview.load(file) it loads, but the screen is blank, after loading another file, all works fine, it shows the file pdf.js: after use setContent() with filebase, it loads the webviewer.html/.js with a white page and the loading circle. The screen only refresh if I resize the form or use the

How to create a new window button PySide/PyQt?

六眼飞鱼酱① 提交于 2020-01-11 05:58:27
问题 I'm having problems with a "New Window" function in PyQt4/PySide with Python 2.7. I connected a initNewWindow() function, to create a new window, to an action and put it in a menu bar. Once a common function in desktop software. Instead of giving me a new persistent window alongside the other one the new window pops up and closes. The code I'm working on is proprietary so I created an example that does the same thing with the same error below. Is there any way to get this to work? Runs in

How to add multiple QPushButtons to a QTableView?

主宰稳场 提交于 2020-01-11 05:43:29
问题 I have a QTableView to which I want to set a QPushButton for every row. I am doing this as follows within my class derived from QWidget following an example found here: for index in range(number_rows): btn_sell = QPushButton("Edit", self) btn_sell.clicked.connect(self.button_edit) table_view.setIndexWidget(table_view.model().index(index, 4), btn_sell) If the table is drawn and I click on one of the QPushButton the method self.button_edit is called - but which one? It does not seem that an

pyside widget run with threading.Thread class

醉酒当歌 提交于 2020-01-06 07:07:27
问题 I have obtained a widget from a QtDesigner and converted .ui file to .py file by pyside. now I want that widget to organize a database and an apart threading.Thread (in same module) to open and read database and send to UDP. the fact that I know how to deal with all these apartly but when bringing together it is hard. should I use thread as a class inside my widget class which is: def setupUi(self, Form): ... def retranslateUi(self, Form): ... if __name__ == "__main__": ... Form.show() and

PySide create horizontal tabs with horizontal text

前提是你 提交于 2020-01-06 05:47:30
问题 I am trying to use this solution by @eyllanesc: pyqt qtabwidget horizontal tab and horizontal text in QtDesigner. My main window has a QStackedWidget in which one of the pages is the page with horizontal tabs. I used Qt designer to create a dialog with a tab widget, and set the tabPosition to West. Then I promoted the TabWidget like shown in the original post. This is what the resulting window looks like. There are no outlines around the tabs, and the tabs are not clickable: This is my main

Only Key_Tab & ShiftModifier does't work well with PySide

拜拜、爱过 提交于 2020-01-06 04:41:13
问题 Pre I searched other Questions and couldn't find out the solution. I want to execute Tab key and Shift operation simultaneously because I want to add a new performance by pressing tab key.I know the Shiftmodifier enum is good. But it doesn't work when the key is Tab key.Do you know how to control it? On the other hand,Controlmodifier works well. When I pushed Tab key tab only When I pushed Tab & Control Key tab & Control When I pushed Any Key except for Tab & Shift Key print("tab & any key

PySide, Qdate; run a specific function everyday in a specific time

被刻印的时光 ゝ 提交于 2020-01-06 03:03:44
问题 I am trying to develop a gui with PySide and I wonder if there is a way to call a function in Python ( QDate ) and run it in a specific date and time? for example: #run this function in everyday at 8:00 am. def print_something(): print "Hello" 回答1: Here is a script adapted from Chapter 4 of Summerfield's PyQt book, his alert.py example. It is available free online here: http://www.informit.com/articles/article.aspx?p=1149122 Basically you set a target QDateTime , and then you can trigger