qt

QT 2d list causing segfault

Hi everyone, I've got a program that worked until recently. The offending code is shown here: void writeTimeInfo(fitsfile *fptr, QList<QList<double> > &in) { double data[in.size() * in[0].size()]; long naxes[2]; int status = 0; naxes[1] = in.size(); naxes[0] = in[0].size(); for (int i=0; i<naxes[1]; i++) { for (int j=0; j<n...

Is it possible? Matching the exact same number of opening & closing braces

I'm no expert on Regex. I'm trying to create a regular expression that will match the exact same number of opening and closing braces, but I'm stumped on how to do it. An example: nothing: important, a b { c {{{ a another {{ nothing }} }}} } or: one { two {{ error, forgot ending brace }} The problem is that I don't know how many b...

Block All Keyboard Input in a Linux Application (Using Qt or Mono)

Hi, I'm working on a online quiz client where we use a dedicated custom-made linux distro which contains only the quiz client software along with text editors and other utility software. When the user has started the quiz, I want to prevent him/her from minimizing the window/closing it/switching to the desktop or other windows. The quizz...

Qt .pro's transformed into nmake Makefiles can't handle staticlibs, same thing in VS2008 solution works

I've got a buildenvironment based on Qt .pro files transformed to both Visual Studio 2008 solutions and Makefiles (used by nmake). There are about 30 projects, untill recently all compiled into a seperate dll (and the main into an exe). Recently I added a project configured as static lib. Visual Studio links everything just fine. nmake ...

Swapping one widget with another in Qt

What is the best way to "swap" one QGraphicsWidget with another in an existing view? I have a tree view widget and a label widget, and I want them to occupy the same space at different times. Specifically, when there's an error, I want to show it in the label, and when there's no error, I want to show the tree. I have tried programmatic...

Qt - controlling drag behaviour

Suppose I want my draggable widget to move differently than just staying under my cursor while being dragged. For instance, having the widget move only in one axis, or have the widget move double the distance between the cursor and the drag starting point. Which method should I override to define this kind of behaviour? ...

Qt - How to do superscripts and subscripts in a QLineEdit?

I need to have the ability to use superscripts asnd subscripts in a QLineEdit in Qt 4.6. I know how to do superscripts and subscripts in a QTextEdit as seen below but I can't figure out how to do them in QLineEdit because the class doesn't contain a mergeCurrentCharFormat() function like QTextEdit does. Please help. Thanks void MainWind...

Qt switching between views?

How to switch between the two screens in Qt? for example, i have a button,static text plus a toolbar,now i will add it to a frame and set it as central widget it works well for one window.. what if i move to the next widow? there i need to show some other stuffs like some other button, images etc... and what if i come back to the first...

May one create an open source scripting application using QtScript?

Hi there, I'd like to implement my own script engine using the QtScript component and other Qt components. Since this should be an open source (GPL) application I thought I would be free to do this. But now I found a page at Qt's website that made me doubtful about it: What are the restrictions with releasing scriptable application...

Qt: How to force a hidden widget to calculate its layout?

What I am trying to do is render a qwidget onto a different window (manually using a QPainter) I have a QWidget (w) with a layout and a bunch of child controls. w is hidden. Until w is shown, there is no layout calculations happening, which is expected. When I call w->render(painter, w->mapToGlobal(QPoint(0,0)), I get a bunch of cont...

how to run QT from command line in windows

hi all, i installed Qt4 and Qt creator. now i need to know how can i run an application with in command line. I installed QT and QT creator. If i need to create a project i need to open the Qt Creator and create new project and write the code there, compile/build with the QT creator. Is that the procedure in QT. So in this case am not a...

Qt Should I derive from QDataStream?

I'm currently using QDataStream to serialize my classes. I have quite a few number of my own classes that I serialize often. Should I derive QDataStream to create my own DataStream class? Or is there a better pattern than this? Note that these custom classes are used by many of our projects, so maybe doing so will make coding easier. An...

Converting QXmlItem to QtDomElement or similar?

Hello everyone. I'm parsing a fairly complicated XML file of the following structure: <root> ... ... <item> <subitem id="1"/> <text> text1 </text> </item> <item> <subitem id="2"/> <text> text2 </text> </item> ... <item> ... </item> ...</root> It's pretty c...

How to convert .ui(user interface) files into .exe file in QT

I am a fresher in qt,i don't have much knowledge on qt, but i created some of file in qt for my application (regaurding to GUI format).I was created some .ui files in qt,but i wanted these files into .exe format.I think u had unerstand my problem,so please help me ...

reading and writing QByteArrays

I'm having trouble reading and writing QByteArray data to a file. My goal is to save QPixmap data into a QByteArray and save that QByteArray to a file (with the ability to read this QByteArray back from the file and into a QPixmap). I want to use following code from the QPixmap documentation: QPixmap pixmap(<image path>); ...

Multitouch in Linux

I have two questions: How to simulate touch event in linux. How to work with multitouch on Qt in Linux. ...

Multiple QGraphicsViews with one QGraphicsScene

Hi, I am trying to display the items on a graphics scene on two distinct graphics views. My problem is that, I don't want to show all the items on the graphics scene in both views. For example, in my application, on view 1, I will start an editor for the user to draw some items on one view and when the user finishes editing, view 2 will...

QTableWidget signal cellChanged(): distinguish between user input and change by routines

i am using PyQt but my question is a general Qt one: I have a QTableWidget that is set up by the function updateTable. It writes the data from DATASET to the table when it is called. Unfortunately this causes my QTableWidget to emit the signal cellChanged() for every cell. The signal cellChanged() is connected to a function on_tableWid...

XSLT processing with Qt

Hi, I like to display some (X)HTML content in a Qt application using QtWebKit. The content should be generated from XML documents via XSLT. As I am new to Qt, my questions are as follows: 1) Can QtWebKit display XML documents with the xml-stylesheet element set? 2) Can Qt apply XSLT to an XML document and return the result as a string ...

How to fetch output when calling R using Qprocess or system

Hi Experts, I would like to execute a R script simply as R --file=x.R It runs well on the command line. However when I try the system call in C++ by QProcess::execute("R --file=x.R"); or system("R --file=x.R"); the program R runs and quits but I can't see the output the program is supposed to generate. If a program uses no std...