pyqt4

how to change headers data

hello i have the following class class AssetTableModel(QtCore.QAbstractTableModel): def __init__(self,filename=''): super(AssetTableModel,self).__init__() self.fileName=filename self.dirty = False self.assets = [] self.setHeaderData(0,QtCore.Qt.Horizontal,QtCore.QVariant('moayyad'),QtCore.Qt...

ImportError: No module named QtWebKit

I am on centos5. I installed python26 source with a make altinstall. Then I did a: yum install qt4 yum install qt4-devel yum install qt4-doc From riverbankcomputing.co.uk I downloaded the source for sip 4.10.2, compiled and installed fine. Then from the same site I downloaded and compiled from source PyQt-x11-4.7.3 Both installs were...

Images not loading in QWebview in PyQt4 in py2exe

I have an application that displays some HTML in a QWebview, which references images on the local file system. This works fine directly running the python. When compiling via py2exe, the images no longer load. Google doesn't seem to know the answer, any ideas? ...

Type-aware rendering (and editing) of tabular data in pyqt4

I would like to have a very short / minimal example of how to create some tabular widget with different types of item in it. In the first round let's say I'd like to render [["Hello", 12, True], ["World", 13, False]] (Hello as string, 12 as number (right-align), True as a checkbox for eg.), but it would be nice to have Dates, Colors, an...

PyQT4 QWebView not resizing correctly

I have a QWebview in a grid layout, along with other widgets. When the user resizes the window, the QWebview doesn't resize, but the other widgets do. How can I make the QWebview resize correctly? ...

how to get selected item in pyqt Qmenu

hello is there any way to get the selected item in a qmenu ? i want to bind all items in that list to one function and get the item once user click it . i've been looking for a way to get the item's label or index for 3 days , but couldn't find it . any ideas ? thanks in advance ...

PyQt4 Move QTableWidget row with widgets

I have the following method in my PyQt4 app. r2 is the number of row to move, and r1 is the position where it should be moved. To clarify: the table is filled with cellWidgets, not widgetItems. def move_row(self, r1, r2): tt = self.tableWidget tt.insertRow(r1) for c in range(tt.columnCount()): tt.setCellWidget(r1, c,...

PyQt4.QtCore.pyqtSignal object has no attribute 'connect'

I'm having issues with a custom signal in a class I made. Relevant code: self.parse_triggered = QtCore.pyqtSignal() def parseFile(self): self.emit(self.parse_triggered) Both of those belong to the class: RefreshWidget. In its parent class I have: self.refreshWidget.parse_triggered.connect(self.tabWidget.giveTabsData()) When I...

How to use custom drawing in QGraphicsViews in PyQt?

I need to view QGraphicsScene in 2 QGraphicsViews with condition that they have different scale factors for items in scene. Closest function which I found is drawItems(), but as far I can understand, it must be called manually. How to repaint views automatically? I have these two code fragments in program: class TGraphicsView(QGraphicsV...

Can't get custom slot working in PyQT4 with QT4 designer

Hey, I am new to PyQT4. After some tuts I decided to make a simple GUI in which I will enter text in first line and on clicking of Reverse button ,it will show reversed string on second line. I made a custom slot for this,by defining the function in my class.But when I click reverse nothing happens. I have used in-bilt slots for Clear...

how to create a theme with QT

hello im looking for a way to make my pyqt interface look nicer by adding a theme to it. im new to Qt and i still have no idea how to add a custom theme for widgets.. so how is that possible ? and is it possible through qt designer ? sorry for my bad english , its my third language. i hope the idea is clear enough . please let me kn...

how to set a pop up menu on a particular table view item

hello i have a QTableView , and i need to show a popup menu that shows the item properties . i need to set the context menu to apear only when you right click over a particular items in that tableview. but coudln't find a way to do it . i can set the context menu to appear when your over the table . i cant have it for each item . so ho...

PyQt4: My database displays empty cells

Hello everyone. I am using the pyqt4 framework to do some displays for database forms. Unfortunately, I hit a snag while trying to filter and display my database by last name. Assume that the database connection works. Also assume that I have the correct amount of items in my tupleHeader since I use the same initializeModel method fo...

Implementing QItemEditorCreatorBase in PyQt4

I tried to implement QItemEditorCreatorBase to get QComboBox editor for colors in a table. So I wrote an editor: class ColorListEditor(QtGui.QComboBox): def __init__(self, parent=None): super(ColorListEditor, self).__init__(parent) self.populateList() def populateList(self): for i, name in enumerate(QtGui.QColor.colorNames(...

Display an webcam stream in PyQt4 using OpenCV Camera Capture

Hello, I am using this python script do display my webcam : from opencv.cv import * from opencv.highgui import * import sys cvNamedWindow("w1", CV_WINDOW_AUTOSIZE) camera_index = 0 capture = cvCreateCameraCapture(camera_index) def repeat(): global capture #declare as globals since we are assigning to them now global came...

Is there a way to set a fixed width for the characters in HTML?

Is there a way to set a fix size for the characters in HTML? That means, say … First row, 8th character is “Z” Second row’s 8th character is “A” I want to print out , when printed the “Z” has to be exactly on top of “A” *Note: I'm using the insertHtml method in QTextEdit() ...

How can I position QDockWidgets as the screen shot shows using code?

I want a Qt window to come up with the following arrangement of dock widgets on the right. Qt allows you to provide an argument to the addDockWidget method of QMainWindow to specify the position (top, bottom, left or right) but apparently not how two QDockWidgets placed on the same side will be arranged. Here is the code that adds th...

How to get text in QlineEdit when QpushButton is pressed in a string?

I have given my code below, have problem in implementing a function I want the text in lineedit with objectname 'host' in a string say 'shost'. when the user click the pushbutton with name 'connect'.How do i do it? I tried and failed. How to implement this function? import sys from PyQt4.QtCore import * from PyQt4.QtGui import * ...

How to set which browser to use in a QTextBrowser link?

I am using PyQt4's QTextBroswer to display a html link. Whenever users click on the link, a browser will be used to open the internet page. My question is, is there a way to set so that our own prefered browser is used to open the url page instead of the preset one? Thanks in advance. ...

Is it possible to bind a html link in QTextBrowser with a callable function?

...or any other method which provide the similar kind of interaction will do. ...