Re: [Interest] [Qt bugreports] (QTBUG-23223) CONFIG+=silent leads to files being moc'd and uic'd even if unnecessary

2012-01-14 Thread Tony Rietwyk
Hi Roman, 

I am getting this problem, and none of my project files have silent in them.  
I am surprised that it fixes the problem you.  

Tony.



 -Original Message-
 From: Roman HImmes (via JIRA) [mailto:jira-nore...@qt.nokia.com]
 Sent: Saturday, 14 January 2012 3:36 AM
 To: t...@risingsoftware.com
 Subject: [Qt bugreports] (QTBUG-23223) CONFIG+=silent leads to files being
 moc'd and uic'd even if unnecessary
 
 
  [ https://bugreports.qt.nokia.com/browse/QTBUG-
 23223?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
 
 Roman HImmes updated QTBUG-23223:
 -
 
  Status: Reported  (was: Reported)
 Summary: CONFIG+=silent leads to files being moc'd and uic'd even if
 unnecessary   (was: On every build files are moc'd and uic'd even if
 unnecessary)
 Description:
 
 If switching of CONFIG+=silent, the problem goes away.
 
 If having .pris included in your project with an include depth of  1 Visual
 Studio 2010 always exectues moc and uic on every compile run, even if
 nothing has changed.
 
 I attached a small test project to reproduce this:
 
 - extract test.zip
 - Run qmake -tp vc to create a VS2010 project
 
 Compile multiple times, moc_object.hpp is always moc'ed.
 
 
 
   was:
 If having .pris included in your project with an include depth of  1 Visual
 Studio 2010 always exectues moc and uic on every compile run, even if
 nothing has changed.
 
 I attached a small test project to reproduce this:
 
 - extract test.zip
 - Run qmake -tp vc to create a VS2010 project
 
 Compile multiple times, moc_object.hpp is always moc'ed.
 
 
 
 
  CONFIG+=silent leads to files being moc'd and uic'd even if
  CONFIG+unnecessary
  --
  --
 
  Key: QTBUG-23223
  URL: https://bugreports.qt.nokia.com/browse/QTBUG-23223
  Project: Qt
   Issue Type: Bug
   Components: Build tools: qmake
 Affects Versions: 4.8.0
  Environment: VS2010, Windows 7
 Reporter: Roman HImmes
 Assignee: Oswald Buddenhagen
  Attachments: test.zip
 
 
  If switching of CONFIG+=silent, the problem goes away.
  If having .pris included in your project with an include depth of  1
  Visual Studio 2010 always exectues moc and uic on every compile run,
  even if nothing has changed.
  I attached a small test project to reproduce this:
  - extract test.zip
  - Run qmake -tp vc to create a VS2010 project Compile multiple times,
  moc_object.hpp is always moc'ed.
 
 --
 This message is automatically generated by JIRA.
 If you think it was sent incorrectly, please contact your JIRA administrators:
 https://bugreports.qt.nokia.com/secure/ContactAdministrators!default.jspa
 For more information on JIRA, see: http://www.atlassian.com/software/jira
 
 

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] Qt 4.8.0 Main form always opening in the same location ?

2012-01-22 Thread Tony Rietwyk
Hi Everybody, 

I've recently upgraded my application from Qt 4.6.0 running on Windows XP to
4.8.0 running on Windows 7.  Now my main form is always opening at the same
location on screen, whereas in XP, it would use a different position each
time it was run.  The problem is that it's always over my Visual Studio
output pane, so I have to move the main form to see the debug output.  I
don't know whether this is a change in Qt, or Windows 7 feature.  It would
be really nice to know where the values have been stored so that I can
change them!  

Googling qt4 bug main form open same location gives lots of hits for
tutorials, but nothing for this as a bug.  Searching in the registry only
finds MRU list entries, and the Qt image/sql driver caches. 

Is anyone else finding this? 

Tony.


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QSerialport EV_RXCHAR not emitted or catched while moving window

2012-03-15 Thread Tony Rietwyk
Hi Riccardo, 

Is this running on Windows?  I seem to remember that the timers had the same
problem - the events don't get delivered while the window is in resize mode.
I never found a fix or workaround for this, and had to implement my own
timers in a separate thread looping on sleep.  

Hope that helps, 

Tony. 


 Sent: Friday, 16 March 2012 12:45 AM
 
 Again: use the readyRead signal ?
 
 http://qt-project.org/doc/qt-4.8/qiodevice.html#readyRead
 
 On 15 mars 2012, at 14:27, Riccardo Roasio wrote:
 
  Sorry..so what you think i have do do?
 
 
 
  Il 15 marzo 2012 14:26, Samuel Gaist samuel.ga...@edeltech.ch ha
scritto:
  I must say, I don't understand your use of QSerialPort.
 
  You are waiting on data coming from the serial port, aren't you ?
  So, why not just connect to the readyRead signal ?
 
  On 15 mars 2012, at 14:07, Riccardo Roasio wrote:
 
  the serial port class is this one:
 
 
 http://www.google.it/url?sa=trct=jq=esrc=ssource=webcd=1ved=
 0C
  CwQFjAAurl=http%3A%2F%2Fgitorious.org%2Finbiza-
 labs%2Fqserialporte
  i=8OhhT_vNGY6KhQeg6tieCAusg=AFQjCNF7vwKcu_dJz8y-
 QE6ziYhoPe4uNwsig2
  =adTbs9FuJPYZhrNXtnfALg
 
  it expect a EV_RXCHAR event on receiving something on the serial
  port so it reimplements the QWidget event function:
 
  bool WinSerialPortEngine::event(QEvent *e) {
  //   qDebug()event e e-type();
 bool ret = false;
 if (e-type() == QEvent::WinEventAct) {
 if (EV_ERR  m_currentMask  m_setMask) {
 m_parent-canErrorNotification();
 ret = true;
 }
 
 if (EV_RXCHAR  m_currentMask  m_setMask)
 {
 m_parent-canReadNotification();
 ret = true;
 }
 
 //FIXME: This is why it does not work?
 if (EV_TXEMPTY  m_currentMask  m_setMask) {
 m_parent-canWriteNotification();
 ret = true;
 }
 }
 else
 {
  ret = QWinEventNotifier::event(e);
 }
 
 ::WaitCommEvent(m_descriptor, m_currentMask, m_ov);
 return ret;
  }
 
  the problem is that while receiving events like the
  QEvent::NonClientAreaMouseButtonPres on the gui thread it stop
  receivng EV_RXCHAR event on the serial port class
 
 
 
  Il 15 marzo 2012 12:53, Samuel Gaist samuel.ga...@edeltech.ch ha
 scritto:
 
  On 15 mars 2012, at 12:37, Riccardo Roasio wrote:
 
  Hi,
 
  i have a program with :
 
  - a main thread
  - a serial manager thread using Qserialport
 
  i noticed that if i move the main gui the EV_RXCHAR event is not
  fired or cached...
 
  what's wrong?
 
  thanks,
  Riccardo
  ___
  Interest mailing list
  Interest@qt-project.org
  http://lists.qt-project.org/mailman/listinfo/interest
 
  Hi,
 
  With so few information, we won't be really be able to help you.
  But here is a few questions:
  - How is your serial manager thread implemented ? (My guess: run
  reimplementation)
  - Do you have signals slots directly connected ?
 
  Hope this helps
  Samuel
 
  PS:
  Did you also read this article ?
  http://labs.qt.nokia.com/2010/06/17/youre-doing-it-wrong/
 
  And there where a few discussions on the qt-nokia mailing list last
  year about threading, you might want to look for them
 
 


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] qt.conf

2012-03-20 Thread Tony Rietwyk
Hi Graham, 

 

As others have confirmed, the libs library path set in qt.conf cannot be
used to redirect where Qt is loaded from - worse, it may not have any
relationship to the running dll's!   

 

If the defaults of the other locations (like plugins) works for you, then
there is no need to install the qt.conf file at all.  ;O)

 

Regards.

 

 

 

From: Graham Labdon [mailto:graham.lab...@avalonsciences.com] 
Sent: Tuesday, 20 March 2012 9:50 PM
To: Tony Rietwyk; interest@qt-project.org
Subject: RE: [Interest] qt.conf

 

Thanks for your reply

Does this imply that qt.conf cannot be used with windows?

Is this situation the same on Linux?

What CAN qt.conf be used for?

 

Thanks

 

From: Tony Rietwyk [mailto:t...@rightsoft.com.au] 
Sent: 20 March 2012 10:40
To: Graham Labdon
Subject: RE: [Interest] qt.conf

 

Hi Graham, 

 

Windows doesn't know anything about the qt.conf file.  So the Qt code itself
has to be running before it can read the file.  When you install on another
machine, you can add the lib path to the PATH variable, or copy the lib
dll's into the exe's folder, or use a script file to setup the environment
and call your exe, or...

 

Hope that helps, 

 

Tony.

 

 

Sent: Tuesday, 20 March 2012 8:44 PM

 

Hi

I am trying to use the qt.conf functionality

In my qt.conf file I have the following 

 

[Paths]

prefix = C:\\Program Files (x86)\\AcquisitionSoftware\\Qt
file:///\\AcquisitionSoftware\Qt 

 

Running the app through the debugger I can use QLibraryInfo to verify that
Qt is recognising the presence of the conf file

 

I.e. 

QLibraryInfo::location(QLibraryInfo::LibrariesPath) returns C:/Program Files
(x86)/AcquisitionSoftware/Qt/lib

 

However running the application on a machine without Qt installed fails as
it cannot locate QCore4.dll

 

Note that on the target machine the folder C:/Program Files
(x86)/AcquisitionSoftware/Qt/lib exists and contains QCore4.dll

 

Is this a known problem or am I doing something incorrectly?

 

Thanks

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] Qt 4.8.1 and chunked transfer encoding returning 0 size

2012-03-29 Thread Tony Rietwyk
Hi Everybody, 

I've just upgraded from 4.8.0 commercial to 4.8.1 commercial on Win 7 64
bit.  The program accesses a server using HTTPS POST.  When the response
size is less than about 170Kb everything works as before.  With larger
responses, the raw headers also include Transfer-Encoding with value
chunked.  In the network finished slot, readAll then returns an empty
QByteArray.  

Is there something else I need to do to get chunked encoding to work in
4.8.1?   4.8.0 was happily returning responses over 630Kb.  

Thanks, 

Tony.


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Very old wait cursor on Mac OSX

2012-04-03 Thread Tony Rietwyk
Hi Dair, 

Thanks-you for your very thorough explanation.  

Using an animated strip graphic similar to what MS Outlook 2010 does seems
to be a good solution for my app.  

Tony.

 -Original Message-
 From: interest-bounces+tony=rightsoft.com...@qt-project.org
 [mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf
 Of Dair Grant
 Sent: Monday, 2 April 2012 6:22 PM
 To: interest@qt-project.org
 Subject: Re: [Interest] Very old wait cursor on Mac OSX
 
 
 On 2 Apr 2012, at 08:50, Tony Rietwyk wrote:
 
  On Windows 7, it shows the correct spinning blue circle.  On OSX, it
  shows the a cursor with four quadrants - 2 white and 2 black, which is
  very old, and not anti-aliased, so it looks really ugly.  I expect to
  see the spinning rainbow cursor, or possibly the circle of short lines
  that appears when logging in.
 
 Unfortunately Cocoa doesn't provide a built-in wait cursor; however the
 spinning BW quadrant is the historical I'm busy cursor so is arguably
the
 correct one to use.
 
 Mac OS X's Java implementation has an updated version of that cursor but
 unfortunately it's not available to non-Java apps:
 
 http://www.flickr.com/photos/raza/2721851036/
 
 The spinning rainbow cursor is an indication that the app has stopped
 responding to events, which is a separate situation from I'm busy working
 on something. If the app has stopped responding to events, users will
 assume it's OK to force quit it (and clicking the app icon in the Dock at
that
 point will show Force Quit rather than Quit).
 
 The spinning bars activity indicator is not meant as a cursor - that's
intended
 to be shown in a window.
 
 Adobe did actually use the activity indicator as a cursor at one point,
however
 a lot of people find it confusing (it would be like changing the cursor to
a
 progress bar):
 
 http://reliablybroken.com/b/2010/05/death-or-beachball/
 
 
 The lack of a wait cursor in Cocoa is really down to how Apple want
cursors to
 be used. Ideally the app should always show an arrow/non-wait cursor,
 should display progress using an activity indicator/progress bar, and
always
 respond to the user's input.
 
 If you're in a task which just can't be stopped, the user needs to see a
 window-modal sheet or app-modal dialog explaining what's going on (ideally
 with a Cancel button to let them interrupt it, and a progress bar/activity
 indicator to show them something's happening).
 
 
 -dair
 ___
 d...@refnum.com  http://www.refnum.com/
 
 
 
 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] QTimer doesn't fire while resizing windows on Windows

2012-06-05 Thread Tony Rietwyk
Hi, 

Seeing Thiago's response to a recent QTimer question, prompted me to check
whether this Windows problem had been circumvented.   He says that on
Windows QTimer ... deliver events to the Qt event window.  Back in 4.3 and
WinXP when I first looked at this, I found that the events are not delivered
while the user is dragging the edges to resize the window.  Is that still
the case?  Even creating the QTimer to another thread, didn't help.  

In my case, it was significant.  The timer was being used to play MIDI
messages, and the sound would stop!  In the end, I had to use my own loop
and msleep in the player thread.  

Hope this saves someone else from making the same mistake. 

Tony.


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] submit policy

2012-06-22 Thread Tony Rietwyk
Hi Stefan, 

 

When you add the widgets to the data mapper, why don't you also connect the
widgets to a common 'dataChanged' slot, in which you set a timer if not
already started, and then in the timeout, do a manual submit? 

 

Hope that helps, 

 

Tony

 

 

 

From: interest-bounces+tony=rightsoft.com...@qt-project.org
[mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf Of
Stefan
Sent: Friday, 22 June 2012 3:47 PM
To: interest@qt-project.org
Subject: Re: [Interest] submit policy

 

Hi all,

I am still trying to figure this out. So far without much luck.

Does anybody have a clue how this can be accomplished?

I need something like a timedelayed submit on valuechanged-policy, while
Qt only offers a manual and an auto submit policy for the DataWidgetMapper.

Thanks for any idea
Stefan

---


Hi Mark,
thank you for your response!

I have been looking at the QItemDelegate class but am pretty unsure what
method to override.
Can you point me to the right direction?

Thank you in advance
Stefan

From: Mark Brand mabr...@mabrand.nl
To: Stefan noho...@yahoo.com
Cc: Diego Schulz dsch...@gmail.com; interest@qt-project.org
interest@qt-project.org
Sent: Thursday, May 24, 2012 4:48 PM
Subject: Re: [Interest] submit policy

 You're using QSqlTableModel, right? Have you tried adjusting
 QSqlTableModel::EditStrategy to OnFieldChange?

 I am not using the QSqlTableMode, I am implementing my own
QAbstractItemModel, wrapping some driver calls to an USB device.

 But even if I would use QSqlTableModel, I would run into the same
problems, since OnFieldChange only makes sure that All changes to the
model will be applied immediately to the database. My problem is that the
changes to the model come in too late already (they come in on focus
lost).

That's right, this is about the behavior of QDataWidgetMapper (sort of a
view) not the model. The OP wants changes to be submitted to the model
even if the focus never leaves the mapped widget.

I'm pretty sure that this default behavior of QDataWidgetMapper is actually
defined by the delegate, which is QItemDelegate by default. You could use
QDataWidgetMapper::setDelegate() to use your own subclassed delegate
instead.

regards,

Mark

-


Hi Diego,

I am not using the QSqlTableMode, I am implementing my own
QAbstractItemModel, wrapping some driver calls to an USB device.

But even if I would use QSqlTableModel, I would run into the same problems,
since OnFieldChange only makes sure that All changes to the model will be
applied immediately to the database. My problem is that the changes to the
model come in too late already (they come in on focus lost). However I need
the changes to the model already on QWidget::valueChanged (which doesn't
exist on QWidget level), preferable time delayed for QLineEdits and
QComboBoxes.

Thank you for your input
Stefan

From: Diego Schulz dsch...@gmail.com
To: interest@qt-project.org interest@qt-project.org
Sent: Thursday, May 24, 2012 12:41 AM
Subject: Re: [Interest] submit policy

On Mon, May 21, 2012 at 9:15 AM, Stefan noho...@yahoo.com wrote:
 Hello,

 this question is about the submit policy in QDataWidgetMapper.

 There is an AutoSubmit, which submits to the itemModel on focus lost.
 Also, there is a ManualSubmit, submitting only when called
programatically.
 I prefer to use the auto submit policy, since I don't want to have an ok
 button on my dialog needing to be pressed in order to make the change
 permanent. I like that the data is changed immediatly.

 Unfortunately the data is not being submitted until the user defocuses the
 currently changed widget, which he might or might not.
 Eventually he will, one might thinkg, but in my case the connected
ItemModel
 is a wrapper to an externally connected device sitting on the users desk,
 which he can access in parallel. In fact he is now checking this device
for
 his currently made change, but since the autosubmit policy didn't fire
yet,
 he gets a weird user experience.
 The same problem will occur with centralized databases, being accessed by
 multiple clients. One client changes a value in a widget and goes to
lunch.
 The other client still sees the old data.

 Does anybody know of a creative way to come up with a custom submit
policy?
 Like a SubmitOnValueChanged ? Or even a timedelayed submit on value
 changed-policy ?

 Please help
 This is bothering me for weeks now and nobody else at google seems to know
 :)


You're using QSqlTableModel, right? Have you tried adjusting
QSqlTableModel::EditStrategy to OnFieldChange?


 Thank you for any helpful input
 Stefan


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Most direct path to using a QComboBox to edit a cell in a QTableView?

2012-06-25 Thread Tony Rietwyk
Hi Frank, 

What does the standard delegate do for your model/view at the moment?  I
can't recall the specifics, but it certainly uses combo boxes at the moment
- eg, for boolean fields (which I think is painful, but anyway).  

I think you need to give more information about what you are expecting.  For
example, you include 'insert' as an action.  But what does this mean?  If a
user types an entry not already in the list, what do you expect to happen?
Which table would the new entry be inserted into?  

Where should the combo box get its values from?  

Yes I agree that the model view classes take a while to grok.  

Tony.

 Sent: Tuesday, 26 June 2012 2:36 PM
 
 Hello List!
 
 I have a QTableView and I would like to use a QComboBox to insert and
 modify its entries.  I'm looking for the simplest way to do this that uses
as
 much unmodified Qt functionality as possible.
 
 At the moment I am thinking that I can use the class template
 QStandardItemEditorCreator specialized on QComboBox as the most direct
 way to do this.  Two questions:
 
 Am I on the right track here?
 
 What specifically do I need to do to make this work?  I don't really see
the full
 end-to-end logic (i.e., starting with a specific instance of a
 QTableView) of how to hook all of the plumbing together.
 
 (The model backing the QTableView happens to be a QSqlTableModel,
 although -- and please correct me if I'm wrong -- this should be
irrelevant.)
 
 I've looked at a number of examples in the Qt documentation but the ones
 I've found seemed to be concerned with writing custom delegates and
 editors, rather than using existing delegate and editor classes already
 provided by Qt.  Although I do believe I could achieve my end goal with a
 custom delegate, I think using one would be more complicated than
 necessary.  For example, as I understand it, QTableView uses QItemDelegate
 as its default delegate, and that I can achieve my goal without changing
this.
 
 Assuming that I am on the right track, concrete details would be greatly
 appreciated.  I'm lost in the multiple layers of the documentation at the
 moment.
 
 Thanks for any suggestions.
 
 K. Frank


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QFileDialog::getExistingDirectory does not expand tree on Windows 7

2012-06-27 Thread Tony Rietwyk
Hi Eric, 

 

There is a Windows Explorer option to synchronise the left hand tree with the 
currently selected folder on the right.  I'm pretty sure the default is 
switched off.   I have no idea where I found the option though! 

 

Explorer is s buggy.  I wish MS would hurry up and fix the left hand tree 
randomly jumping to the bottom when you click on the folders!  G! 

 

Tony.

 

 

From: interest-bounces+tony=rightsoft.com...@qt-project.org 
[mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf Of 
Eric Clark
Sent: Thursday, 28 June 2012 5:14 AM
To: Qt Interest
Subject: Re: [Interest] QFileDialog::getExistingDirectory does not expand tree 
on Windows 7

 

Oliver,

 

Thanks for your suggestion. I didn’t think to look at that because I have been 
used to seeing the Windows Vista and XP file dialogs for so long and those ones 
do expand, but there is no left pane when it is a directory browsing dialog. 
Therefore, I looked at the way it works in Visual Studio, and you are 
absolutely correct! Visual Studio does the exact same thing, which makes sense 
since they both use native dialogs. This is not a Qt bug, but in my opinion, a 
Windows bug. Thank you for your response!

 

Eric

 

From: interest-bounces+eclark=ara@qt-project.org 
[mailto:interest-bounces+eclark=ara@qt-project.org] On Behalf Of Till 
Oliver Knoll
Sent: Wednesday, June 27, 2012 1:00 PM
To: Qt Interest
Subject: Re: [Interest] QFileDialog::getExistingDirectory does not expand tree 
on Windows 7

 



Am 27.06.2012 um 19:03 schrieb Eric Clark ecl...@ara.com:

Hello All,

 

...QFileDialog::getExistingDirectory(…) and pass in a default directory to open 
to, the native dialog does open to the correct directory. However, the tree in 
the left-hand pane of the Windows dialog does not expand to that location. 

 

Uhm... even though I am using Win 7 as a daily development platform since 
beginning of this year: is the file dialog actually /supposed/ to expand the 
left side? What do other non-Qt apps do?

 

 

Cheers, Oliver

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] download a file form http

2012-07-05 Thread Tony Rietwyk

 Sent: Thursday, 5 July 2012 4:54 PM
 
 Hello,
 
   I'm trying to use this:
 
 http://doc.qt.nokia.com/4.7-snapshot/network-download-main-cpp.html
 
  As a base point for downloading files over the network (surprisingly,
there's
 no such support in built to Qt) I merely found this piece of html file.
Could
 someone show me to the whole example? or otherwise, even better ,
 provide a snippet that'd do that without strange things like include
 moc.h at the end of the file? :)
 
 THanks!
 
 -Sivan

Including the moc output in the cpp file is common practise, as it saves
qmake generating an extra step to compile the moc separately.   Of course,
it relies on the moc step preceding the cpp compile in the build!  

Hope that helps, 

Tony.


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] download a file form http

2012-07-05 Thread Tony Rietwyk
 Sent: Thursday, 5 July 2012 6:03 PM
 
 Thanks for all of the replies, how do I then make the MOC step happen
 before everything else in Qt creator or by plainly using qmake?
 (letting qmake do the right thing did not work).
 
 Thanks again!
 
 -Sivan

It depends on your tool-chain, and how you created the build scripts.  

I use hand-edited .pro (and .pri) files, and run qmake to generate Visual
Studio  and Xcode project files.  

There is an option for qmake to create a .pro file, but I've never used it. 

Tony.


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Problem understanding QAbstractProxyModel::mapFromSource and displaying summary data from a model

2012-07-17 Thread Tony Rietwyk
 Sent: Wednesday, 18 July 2012 2:28 PM
 
 Hi,
  I am writing an app in which I am wanting to display my data in a number
of
 different ways.  (Currently QT4.8 on linux, but will also run it on
windows, if
 this is relevant!)
 
 As an example what I have is a set of tuples with two field, say Name and
 Hours
 
 I have this working with table view and am able to access and edit the
data.
 
 What I want is a not editable view of the data which shows the total of
all the
 Hours for each Name.
 
 I have used the QAbstractProxyModel class to do this.
 
 My problem is I do not know how to implement the mapTosource and
 mapFromSource functions as there is not a direct 1 to 1 correlation
between
 indexes in the proxy model and indexes in the source model.  The function
 definitions appear to assume that this is the case.
 
 I have done a basic implementation of these functions which returns a
 default QModelIndex.
 The part I have found which is not working is that that the summary  or
total
 view does not update when I change values in the other view.I have
 changed
 the emit in the setData function to cover the whole model.
 
 The summary view does update when it gets focus.
 
 Can someone please tell me if there is something better  than the
 QAbstractProxyModel for me to use for this purpose and
 
 How is the mapFromSource function suppose to work when there is not a 1:1
 mapping between the abstract model and the source model?
 
 Are there any samples of QAbstractProxyMode available?
 
 
 With thanks,
 Hugh

Hi, 

I think QAbstractProxyModel only applies when there IS a direct mapping
between the elements of each model, that maintains their identity.  

You need a model with an element for each group (or grouping level), that
listens for the changes in the source model and adjusts the group's summary,
then signals the change for that one group.  

The QML VisualDataModel component looks like it has grouping capabilities.
Maybe you can get some ideas from its implementation? 

Hope that helps, 

Tony.


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] about QSettings

2012-07-18 Thread Tony Rietwyk

   *Sent:* Tuesday, July 17, 2012 9:22 PM
  
   hi,
   when i use the qt 4.7.4 with windows xp, i found that when i use the
   QSettings to write sub key of HKEY_LOCAL_MACHINE, it fails.
   but when i write the sub key of HKEY_CURRENT_USER, it success.
  
   i know that QSettings use the windows api (eg RegCreateKey) to
   do it, so I use the RegCreateKey to do it directly, but it fails too.
  
   my windows account is administrator.
  
   thanks in advance.

Hi, 

What error do you get from calling RegCreateKey directly?   What type of
application is it?  How is it started?  

Tony


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QLIneEdit Bug still valid ?

2012-07-19 Thread Tony Rietwyk
Andre said

 Sent: Tuesday, 17 July 2012 6:22 PM
 
 Op 17-7-2012 9:45, Tony Rietwyk schreef:
  Hi,
 
  A much easier solution to disconnecting the signals, is to set a flag
before
 calling setText, then check that in the slot.
 
  Hope that helps,
 
  Tony
 
 Or use QObject::blockSignals(true) on the line edit before you set the
text,
 and the same with false afterwards. Seems easier to manage than another
 boolean flag somewhere, because it stays local to the place where you do
 the actual invokation. The flag would need code at three
 places: around the invokation, in the header as a member variable, and in
the
 slot implementation when it is checked.
 
 André

Hi André, 

I don't use blockSignals because the side effects are undocumented.  The
problem is that ALL signals are blocked, not just the specific call to your
slot.  Lots of things rely on the changed signal from QLineEdit - attached
models and complex widgets, like QComboBox, for example.  Also, from reading
the Qt code in general, there is often a complex web of internal signals
between the public and private interfaces, and I've always assumed they are
affected as well (?).  

Tony


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Creating Desktop Widgets (aka Desklets) in Qt

2012-07-24 Thread Tony Rietwyk

 Sent: Wednesday, 25 July 2012 1:35 AM
 
 Hi, I am tasked in creating desktop widgets (aka desklets, stuff like system
 monitors, clocks, etc) in Qt, the target platform is Windows.
 
 So far I managed to create a frameless window which stays on bottom and
 isn't shown on taskbar by following window flags:
 Qt::SubWindow | Qt::FramelessWindowHint |
 Qt::WindowStaysOnBottomHint
 
 However no matter what I tried, I didn't manage to keep the desklets shown
 when user presses the Windows show desktop icon. Does anybody know a
 way?
 
 The desklet class is a subclass of QWidget, using QDesktopWidget doesn't
 help the situation at all (and from docs it's clear it is for different 
 purpose).
 I tried intercepting events which make the desklet hide, but it seems this is 
 a
 special case not handled by any event... I tried all prospective window flags,
 even those more crazy in the aspect. But all to no avail...

They are called gadgets on Windows.  From a quick read, I doubt Qt is any use: 

http://msdn.microsoft.com/en-us/library/windows/desktop/bb456468%28v=vs.85%29.aspx

Regards, 

Tony


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Does QNetworkAccessManager 4.8.1 handle compressed output from an Apache server?

2012-08-22 Thread Tony Rietwyk
Answering my own question...  Yes QNAM handles receiving compressed
responses no problem.  

Would still be nice to know how to enable it for sending compressed
requests?  

Tony. 


 -Original Message-
 From: interest-bounces+tony=rightsoft.com...@qt-project.org
 [mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf
 Of Tony Rietwyk
 Sent: Wednesday, 22 August 2012 4:03 PM
 To: interest@qt-project.org
 Subject: [Interest] Does QNetworkAccessManager 4.8.1 handle compressed
 output from an Apache server?
 
 Hi Everybody,
 
 My application talks to an Apache server to send and receive xml data.
 Most of the request xmls are small.  The response xmls can vary up to
10Mb.
 It has been suggested to use
 http://httpd.apache.org/docs/2.2/mod/mod_deflate.html to compress the
 responses.  Will QNAM handle this?  Note that the requests use https:
 protocol.
 
 Thanks!
 
 Tony
 
 
 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] memory fragmentation?

2012-08-22 Thread Tony Rietwyk
Hi Jason, 

 

If there are 5 public objects whose d-pointers reference the same private
object address, how are you going to update them when you relocate the
private object?  

 

I don't think .Net stores addresses, just handles, so the relocate only
needs to update the handle info.   That's why you have to go through all of
the marshalling crap when you do want to pass the address somewhere!  

 

Tony.

 

 

From: interest-bounces+tony=rightsoft.com...@qt-project.org
[mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf Of
Jason H
Sent: Thursday, 23 August 2012 11:18 AM
To: Constantin Makshin; Qt Interest
Subject: Re: [Interest] memory fragmentation?

 

I'll take that as a compliment. I fully expected someone to raise the issues
you did. And I will counter them with the following comments.
Yes, Qt would be less predictable, but more predictable than .NET's
allocator. If you want GC-like features, it'll come at a GC-like price. 
Next on when to do it, if we know the compacted size of all the objects
stored, we can calculate a density (total size/(largest address-smallest
address)) and compact at a certain threshold. Since all the reallocations
would be consecutive, they should be contiguous. This then would free up
memory pages and should increase pagefile performance. 
You do mention a complication - in that Dptrs are allocated immediately,
which means we can never move the original non-private class, unless we have
some other way to reference a QObject (name()?) and the expectation that
that is the only way to access it, unless when we start to use it we set
some no_move mutex. 

And I am sure others are wondering, just as I still kinda do, if all this is
worth it. And my only answer to that, is MS did it for .NET, so there's got
to be some good reason why they did it like that.




 

 

  _  

From: Constantin Makshin cmaks...@gmail.com
To: Qt Interest interest@qt-project.org 
Sent: Wednesday, August 22, 2012 8:37 PM
Subject: Re: [Interest] memory fragmentation?


I doubt that implementing moveable private objects/pointers would be
[really] useful.

Firstly, Qt can't control the location of the memory block allocated
by new/malloc, so the assumption that some [random] reallocations will
improve the contiguity of allocated memory looks quite naive.

Secondly, d-ptr allocation is (in most cases) the first operation
performed by an object constructor, so there's some (not too little, I
think) chance the private object will be placed directly after its
public buddy. In this case, destruction of both objects won't create
any excess holes in allocated/free memory.

And, at last but not at least, moving private objects around would
unnecessarily complicate Qt's internals (reallocation itself, code for
deciding when and where the d-ptr should be moved, etc.) and,
probably, make it less predictable in terms of performance
(reallocating d-ptr without reallocating sub-pointers makes little
sense IMHO, and moving all that stuff around can be expensive).

Yes, the idea is interesting, but crazy. :)

On Wed, Aug 22, 2012 at 9:27 PM, Jason H scorp...@yahoo.com wrote:
 C++ on .NET functions as it does now, however the compiler introduces the
 operator of ^ as a type modifier like * (pointer)
 ^ are handles to managed objects, as * are addresses of objects. The
runtime
 then handles dereferencing the handles for you. jsut like your compiler
uses
 the appropriate instructions with a pointer.

 Now, here's my crazy idea. If we have small objects - say Qt's interface
 classes, and large objects, say Qt's private classes, then could we do
some
 d-ptr trickery where Qt can reallocate and copy/move the memory around and
 reassign a d-ptr? We can't get all the coolness of .NET's GC, but we can
 come close, at least for large objects (objects using d-ptrs). We've
 already talked about the GUI, but what is more interesting to me is a
 QObject hierarchy (not necessarily QWidgets) in that you could say for
this
 large, old tree of objects, do something that would result in better
(more
 contiguous) memory allocations.




 
 From: Konrad Rosenbaum kon...@silmor.de
 To: interest@qt-project.org
 Sent: Wednesday, August 22, 2012 4:50 AM

 Subject: Re: [Interest] memory fragmentation?

 Hi,

 On Tuesday 21 August 2012 12:01:49 Bo Thorsen wrote:
 Memory fragmentation is defined as the problem where you allocate a
 bigger chunk of memory than what is available, even if the total amount
 of free memory is available.

 Do you know if the ^ implementation in .NET actually does the realloc
 stuff, or do they only say that it's a possibility? I ask because this
 sounds hard to do well. You either have a really slow operation running
 often (just moving stuff back) or an almost impossible task (move things
 *you will keep for a long time* to the front of temporary objects.

 I'm not entirely certain how C++ is implemented on .NET - it is an alien
 in
 that world, since it normally 

Re: [Interest] What did I do?

2012-09-04 Thread Tony Rietwyk
Hi Bill, 

Diego's response of SelectionBehaviour should only apply when you click in
the cells - not the header.  

In 4.6.0, I added code to achieve this.  Have you recently changed version?
I can't see any property in QHeaderView to control this behaviour.  

If you think that the default behaviour has changed between versions, please
raise a bug!  

Tony.


 Sent: Wednesday, 5 September 2012 8:37 AM
 
 Hello:
 
 What did I do?
 
 In my app, when I click in a section of the horizontal header a table
view, all
 items in the corresponding column are selected.
 
 Is this a default behavior?
 Must I have done something to enable this behavior?
 How do I turn off this behavior?
 
 Thanks.
 
 Bill


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] What did I do?

2012-09-05 Thread Tony Rietwyk
Hi Konrad, 

 

I agree that those properties apply to clicking on the table cells.  

 

But I think the OP is referring to QHeaderView.  The only behaviours
documented are dragging, resizing and highlighting the sections.  Other
behaviours such as selecting cells, or changing the sorting, you have to
code yourself in the appropriate slots.  

 

Bill,  are you referring to QTableView or QTableWidget?   Which Qt version
and OS version are you seeing this behaviour on? 

 

Regards, 

 

Tony

 

 

From: interest-bounces+tony=rightsoft.com...@qt-project.org
[mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf Of
Konrad Rosenbaum
Sent: Wednesday, 5 September 2012 4:44 PM
To: interest@qt-project.org
Subject: Re: [Interest] What did I do?

 

Hi,

 

On Wednesday 05 September 2012 00:37:11 Bill Crocker wrote:

 What did I do?

 

Nothing. This is the default.

 

 In my app, when I click in a section of the horizontal header a table
view,

 all items in the corresponding column are selected.

 

 Is this a default behavior?

 Must I have done something to enable this behavior?

 

The default is to allow multiple cells to be selected at the same time:

 

* click on cell: select this cell

* click on row header: select the entire row

* click on column header: select the entire column

* no meta keys pressed at that time: deselect current selection and make
fresh selection

* Shift pressed: make it a range selection spanning from the last selected
cell to the new one

* Ctrl pressed: add to the existing selection

 

 How do I turn off this behavior?

 

Chose a different selection behavior, see
QAbstractItemView::SelectionBehavior and ...::SelectionMode for details.

 

The default is a Behavior of SelectItems and a Mode of ExtendedSelection

 

 

 

Konrad

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Designer - can't remove items in 'Edit Tree Widget'

2012-09-05 Thread Tony Rietwyk

 Sent: Thursday, 6 September 2012 4:26 AM
 
 Hi,
 I have created a widget with a tree widget and added some items and
 subitems (right click, 'Edit Items...') in the Qt Designer
 v4.8.2 (MS Windows 7).
 If I want to remove an item with the minus button, nothing happens.
 Something wrong?
 
 Thomas

The designer support for editing model view widget items has been buggy for
some time (4.6.0 and 4.8.1).  I find that just adding entries gets the text
corrupted (out of order, last entry added is blank, etc).  I assume there is
already a bug for this.  I just edit the .ui xml directly to work-around it.


Tony.


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] How to build Qt using multiple CPU's on Mac?

2012-09-20 Thread Tony Rietwyk
Hi Everybody, 

On windows when I run nmake after configure, it uses all of my CPU's and is
finished in under 2 hours.  

On mac OSX Lion with XCode 4.3.2, when I run make after configure, it only
uses 1 CPU.   My google fu is not working and I can't find the parameter for
make to get it to use more CPU's.  

(It seems the problems forcing Qt compile to target OSX 10.6 have come back
in 4.8.3, hence my need to build Qt a few times already).  

Thanks! 

Tony. 


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Tree Model and QListView

2012-09-27 Thread Tony Rietwyk
Hi Pierre, 

 

Have a look at setRootIndex.  Both QListView and QTableView can point
anywhere within a tree model.  

 

Hint:  When you can't find a function in a Qt class - make sure to click on
the 'List of all members' link in the Assistant.  Especially the more high
level classes!   Despite the name, the abstract base classes often have
loads of in-built functionality.  

 

Hope that helps, 

 

Tony

 

 

 

From: interest-bounces+tony=rightsoft.com...@qt-project.org
[mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf Of
Pierre-Étienne Messier
Sent: Thursday, 27 September 2012 11:41 PM
To: interest@qt-project.org
Subject: [Interest] Tree Model and QListView

 

Hi, 

 

Let's take the Simple Tree Model example (
http://qt-project.org/doc/qt-4.8/itemviews-simpletreemodel.html ) with the
TreeModel and TreeItem classes. Let's say the internal data structure looks
like this:

 

root

|

+ Category1

|-- Item

|-- Item 

|-- Item 

|

+ Category2

|-- Item

|-- Item 

|-- Item 

|

...

 

 

I want to display that model inside a custom QListView to only show one
Category at a time. So far, I ran a few tests and for example, setting the
root element (in the model) as Category2 will indeed show only Category2 in
the QListView (desired behavior).

 

I want that when navigating with the keyboard arrows left-right keys would
reset the model root node inside the QListView (Category1, then Category2
and so on). Would it be a good idea to:

1.  Subclass QListView to catch the Left/Right arrow keypress
2.  Destroy the current model in the view, creating a new model with the
new desired root element
3.  Replace the model in the view by the new one

On paper, it seems quite inefficient to me. Any experience with that kind of
operation? Could I just do this all inside one model instead?

 

Thanks,

 

Pierre-Étienne Messier

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Re-ordering items in QListWidget by drag-and-drop

2012-10-01 Thread Tony Rietwyk

 Sent: Tuesday, 2 October 2012 12:12 AM
 
 On 10/1/12 9:55 AM, R. Reucher wrote:
  On Monday 01 October 2012 15:54:30 R. Reucher wrote:
  What else should I set so I can reorder items? Or does QListWidget
  not support it?
 
  You have set the dragDropMode property to InterMove!
  Correction: the property's value is 'InternalMove'.
 
 That doesn't work. This how I setup the widget:
 
  m_inkList-setSelectionMode(QAbstractItemView::SingleSelection);
  m_inkList-setMovement(QListView::Free);
  m_inkList-setDragEnabled(true);
  m_inkList-viewport()-setAcceptDrops(true);
  m_inkList-setDropIndicatorShown(true);
  m_inkList-setDragDropMode(QAbstractItemView::InternalMove);
 
 I forgot to mention this is Qt 5. On Mac there's no visual hint on
anything
 being selected or movable. On Windows, I can see selection of one item but
 still not movable.

I think you also need to use QListWidgetItem::flags Qt::ItemIsDragEnabled.
I'm not sure about the Qt::ItemIsDropEnabled flag for internal moves.  

Tony.


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QTreeView width with scroll bar

2012-11-08 Thread Tony Rietwyk

 Sent: Thursday, 8 November 2012 6:40 PM
 
 On 2012/11/08 09:23 AM, Alex Strickland wrote:
 
  However, when the QTreeView gets long enough to automatically add a
  scroll bar - my calculations don't work and one of the check box
  columns is obscured by the scrollbar. How can I check if the scroll
  bar is activated and, if so, obtain it's width to factor into my
calculation?
 
 I should write the message and just not send it... :
 
 class CrossTabTreeView : public QTreeView {
 public:
  CrossTabTreeView(QWidget* parent = 0) : QTreeView(parent) {}
  void resizeEvent(QResizeEvent* /*event - suppress unused warning*/)
  {
  if (model()-columnCount() == CrossTabView::ColumnCount) {
  int scrollBarWidth = 0;
  QScrollBar* scrollBar = verticalScrollBar();
  if (scrollBar) {
  if (scrollBar-isVisible())
  scrollBarWidth = scrollBar-width();
  }
  resizeColumnToContents(CrossTabView::RowColumn);
  resizeColumnToContents(CrossTabView::ColumnColumn);
  setColumnWidth(CrossTabView::QuestionColumn,
 width() - columnWidth(CrossTabView::RowColumn)
 - columnWidth(CrossTabView::ColumnColumn) -
 scrollBarWidth);
  }
  }
 };
 
 --
 Regards
 Alex

Hi Alex, 

The QAbstractScrollArea  docs are a bit vague.  Many of the standard event
handlers are overloaded to be called when the viewport (sub) widget gets the
events.  The docs don't say what happens to the normal events for
QAbstractScrollArea.  When a resize occurs, does resizeEvent only get called
once for the viewport, or twice?  If twice, how do we know which widget the
event is for?  

Instead of width() - scrollBarWidth, I suggest to use viewport()-width(),
which should already exclude the vertical scroll bar.  

Tony.


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Why is this not working? Assign direct to QML (through setContextProperty) works, as function doesn't.

2012-11-08 Thread Tony Rietwyk

 Sent: Friday, 9 November 2012 8:19 AM
 
 Hi,
 
 Lets take this (pseudo code) as example.
 I made a custom QStringListModel class and calles it PathModel:
 
 pathmodel.h
 class PathModel : public QStringListModel {
 public:
 explicit PathModel(QObject *parent = 0); };
 
 Then i made a custom utils class where i just make some random
 functionality available. Like so:
 
 util.h
 class Util : public QObject
 {
 Q_OBJECT
 public:
 
 Q_INVOKABLE PathModel* pathModel();
 Q_INVOKABLE QString testString() { return some_test_text; } 
 };
 
 Then i have the main file where i create the QML context and load a QML
file.
 Just the default stuff when you make a QML application through QtCreator.
 It looks like this:
 
 Q_DECL_EXPORT int main(int argc, char *argv[]) {
 QScopedPointerQApplication app(createApplication(argc, argv));
 
 QmlApplicationViewer viewer;
 viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
 viewer.setMainQmlFile(QLatin1String(qml/Porpoise/main.qml));
 viewer.showExpanded();
 
 return app-exec();
 }
 
 The above helps understanding the context. In the above you can already
 see that i want to send the Util class to QML. I do that like
 so:
 
 Util util;
 viewer.rootContext()-setContextProperty(Util, util);
 
 Now in QML i call:
 Util.testString()
 Reply: some_test_text
 
 That is es expected. Nothing wrong.
 
 Now if i call:
 Util.pathModel()
 Reply: undefined
 
 UNDEFINED..! Why?
 
 If i do this:
 viewer.rootContext()-setContextProperty(PathModel, Util.pathModel());
 
 and then call it in QML like so:
 PathModel
 Reply: QStringListModel(0x2072430)
 
 QStringListModel is OK since PathModel inherits from that. So assigning it
 directly to QML works, but assigning it through some other class doesn't.
Can
 anyone tell me why that's the case? And more importantly, how can i fix
this?
 
 Note: i cannot do qRegisterMetaType on the PathModel since it's class that
 inherits from a class that forbids copying the data (copy constructor
stuff).
 
 Cheers,
 Mark

Hi Mark, 

Try adding Q_OBJECT to your PathModel - maybe the function doesn't work
because the returned value does not have its own moc object. 

Tony.


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] calling QMessageBox::warning() may break the DLL detaching on VS2010

2012-11-15 Thread Tony Rietwyk
Hi Xulei, 

 

I've always considered DllMain to be only used for thread based
initialisations and finalisations.  IIRC, it's design is flawed - process
unload can occur without the individual thread unloads.  This made it
useless to disconnect thread specific database objects, for example.  

 

I'm amazed that window related calls like ::MessageBox are even allowed in
DllMain, I certainly wouldn't expect them to work!  

 

You're better off using standard debugging interfaces like qDebug() to track
things in DllMain.  

 

Tony.

 

 

 

From: interest-bounces+tony=rightsoft.com...@qt-project.org
[mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf Of
Xulei
Sent: Wednesday, 7 November 2012 1:58 PM
To: interest@qt-project.org
Subject: [Interest] calling QMessageBox::warning() may break the DLL
detaching on VS2010

 

Hi All,

I'm developing a project with Qt4.8.3 on Win7/VS2010. I found a critical
issue when calling QMessagebox::warning (actually, information(), critical()
have the same issue too, but question() not). To duplicate the issue
according the following steps:

1.   Create a Qt Application project (named QtTest) in VS2010 by Qt
Add-in with default settings.

2.   Add an action, and call QMessageBox::warning() in its slots.

3.   Create another DLL project (named MyDll) in VS2010, with a single
export function (named foo).

4.   Call the exported function foo in QtTest project.

5.   Call ::MessageBox of Windows API in DllMain of MyDll project to
show whether the DllMain with DLL_PROCESS_DETACH is called when program
exiting.

6.   Start the QtTest.exe, then exit, the ::MessageBox in DllMain of
MyDll will be called.

7.   Start the QtTest.exe, then trigger the action create in step#2,
then exit, the MessageBox in DllMain of MyDll will not be called.

 

Note, the issue may not be duplicate on very PC, I had tested more than 10
PCs, and about half PCs could duplicate this issue.

As you know, when the DLL detach is not called, the other cleanup work won't
work too, such as destructors of local static objects and global objects
won't be called.

The URL is the source code I mentioned above.

http://pan.baidu.com/share/link?shareid=118233
http://pan.baidu.com/share/link?shareid=118233uk=2147844989
uk=2147844989

 

 

 

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Can I update contents in QScrollArea dynamically?

2012-11-15 Thread Tony Rietwyk
Hi Li, 

 

This seems to be a common mistake - adding widgets directly to the
QScrollArea as child widgets, rather than using its setWidget.   Read the
docs - they are very clear.  

 

Tony.

 

 

 

From: interest-bounces+tony=rightsoft.com...@qt-project.org
[mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf Of
Zhang, Li
Sent: Friday, 2 November 2012 12:04 AM
To: interest@qt-project.org
Subject: [Interest] Can I update contents in QScrollArea dynamically?

 

Hi All,

 

I want to use a QScrollArea as a container of several buttons[or other
components], and then I need to replace all of these buttons with new(also
the amount of buttons is different). 

Current, I just  add buttons to the QScrollArea, but can not remove all of
them and update with new buttons...

groupBox = new QGroupBox(ui-GCultureDetailedScrollArea);

groupLayout = new QGridLayout(groupBox);

groupBox-setLayout(groupLayout);

groupLayout-setVerticalSpacing(15);

groupLayout-setHorizontalSpacing(10);

 

for(int i = 0; i  50; i++){

 div

for(int j = 0; j  3; j++){

QString buttonName = QString(button%1).arg(i+1);

QPushButton *pbutton = new QPushButton(buttonName);

//pbutton-resize(130, 40);

pbutton-setMinimumWidth(140);

pbutton-setMinimumHeight(40);

pbutton-setStyleSheet(\

   QPushButton{\

border-image:
url(./pictures/button_groupactivities.png);\

  nb sp;}\

   QPushButton:pressed {\

border-image:
url(./pictures/button_groupactivities_clicked.png);\

   }\

   );

groupLayout-addWidget(pbutton, i, j);

}

}

 

So now how can I remove all of buttons in groupLayout an d add new ones.

 

Anyone can give some suggestions?   Thanks in advance!

 

--

 Best Regards,

 

 

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] Project using QuaZip needs zlib headers

2012-12-05 Thread Tony Rietwyk
Hi Everybody, 

I just incorporated the QuaZip project into my Qt 4.8.3 application which is
built on Windows, Mac OS and Debian platforms.   quazip/zip.h refers to
zlib.h.   In order to compile I have added this line to my .pro file:  

INCLUDEPATH += $$QMAKE_LIBDIR_QT/../src/3rdparty/zlib

This seems quite a hack.  What is the correct way to resolve this reference?


Thanks! 

Tony.


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Widget cross-platform (minimum) size constraint problem.

2013-01-01 Thread Tony Rietwyk
Hi, 

 

The short answer is NO - Qt does not guarantee that designer created layouts
look identical on all platforms.   Especially on Mac where the minimum sizes
are much larger due to the larger default font size and layout margins.
The same widget type will have different default minimum sizes depending on
the platform and desktop style.  

 

It's not clear to me why you have put the groups in a scroll area, if you
don't want scroll bars to be shown.   If you drag the layout into a normal
dialog or main window, then the minimum sizes that you have set should be
respected, and the group boxes should grow if you have allowed that.  

 

Tony.

 

 

 

From: interest-bounces+tony=rightsoft.com...@qt-project.org
[mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf Of
Goblin Coding
Sent: Wednesday, 2 January 2013 5:13 PM
To: interest@qt-project.org
Subject: [Interest] Widget cross-platform (minimum) size constraint problem.

 

Hi All,

First of all, I have had a look at the documentation, I've tried various
combinations of setting minimum sizes, different size policies, calling
updateGeometry() and adjustSize(), I've searched the forum for qwidget
minimum size and others, I've asked Google.and I'm still stuck.

Background
I have a widget deriving from QScrollArea. This widget is populated with a
bunch of QGroupBox'es in a horizontal layout (the main layout for the
widget). Each QGroupBox contains buttons and/or other standard Qt widgets
and all of them have layouts assigned to them and their content.

The problem
On Windows, I manage to ensure that the widget is created with the minimum
size required to display the content WITHOUT having to show any scroll bars
by setting the minimumSize property (using QtCreator and designer) and
setting both the horizontal and vertical size policies to Fixed. This
works just fine. 

However, compiling the same code on Ubuntu (12.04 LTS), the widget is
displayed with the horizontal scroll bar showing at start-up. Now, I can
obviously sort that out (for Ubuntu) by playing around with the minimum size
settings, but that kind of defeats the point of code once, deploy
everywhere.

The question
Is there a way to ensure that what I see in designer is what I get? In case
this is not clear: is there a way to ensure that the widget, when set on a
parent widget or window, will look exactly like it does when viewed in
designer?

Qt details:

QtCreator 2.4.1 based on Qt 4.7.4 (32 bit) 

Thanks for your help!

 

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Report designer

2013-01-03 Thread Tony Rietwyk
Hi Muhammad, 

 

We use http://www.nocisoft.com/ncreport.html.   It integrates easily and does 
basic reports well.   We use some of the advanced features (scripting), but not 
master-detail so can't comment on that.   The support is first class - problems 
are usually addressed within 24 hours!  

 

Regards, 

 

Tony

 

 

From: interest-bounces+tony=rightsoft.com...@qt-project.org 
[mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf Of 
Muhammad Bashir Al-Noimi
Sent: Thursday, 3 January 2013 7:22 PM
Cc: developm...@qt-project.org; interest@qt-project.org
Subject: Re: [Interest] Report designer

 

On 01/02/2013 06:13 PM, Muhammad Bashir Al-Noimi wrote:

Hello guys,

Could anyone guide me to best open source database report designer for Qt?

PS
I found many designers but I want a tested designer.

I found these designers but I'm not sure what's best or what if there is better
http://sourceforge.net/projects/qtrpt
http://exaro.sourceforge.net/




-- 
Best Regards
Muhammad Bashir Al-Noimi
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] Interval QTimer not firing in server after running for months

2013-01-13 Thread Tony Rietwyk
Hi Everybody, 

My Qt server runs on machines in the cloud with Debian 'squeeze' and Qt
4.6.3.   It needs to respond to changes in its configuration settings file.
Since QFileSystemWatcher didn't work, my code just polls every 10 minutes
using QTimer.   It has been running since 10 Oct last year.  A recent config
change was not picked up by the server.  

Are there any known problems with QTimer running for months on end -
especially in that Qt version?  

Thanks! 

Tony


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Bringing Qt, C++ To The Web

2013-01-18 Thread Tony Rietwyk
 -Original Message-
  Anyway, that [zero-install] is definitely a legitimate issue. However
 I  have to puke and kick a puppy when it comes to overall web
development.
  We were approaching something really good with Java and .NET, but
 these  got sidelined by a handful of easy-to-implement standards that
 now  requires you to know a minimum of 3 technologies, but more like 6:
 HTML,  JS, CSS, MIME, SQL, .NET or Java or PHP, not to mention
 Linux/IIS server  administration.
 [...]
  Wt on the other hand, is C++ and takes care of all of that for you.
 You  can provide a CSS, but you don't have to. It doesn't matter if
 tomorrow  the web ditches HTML for XML or pure javascript, or ditches
 MIME headers  for JSON ones. The toolkit will take care of it for you.
 Don't recode,  just recompile. And let the toolkit take care of browser
 sniffing.
  Everything made hard by traditional web development is made obsolete by
 Wt.
 
  And yes, I would love it if Qt and Wt merged.
 
 I did try Wt and do find it awesome for server-side development.  But the
 thing when being server-side is that you can always come up with your own
 solutions.  After all, you can run native code on the server.
 If Wt didn't exist, you could always write your own abstraction layer for
your
 C++ code.  They key is, you *can* run your C++ code.
 
 When being client-side there's no such freedom.  Your C++ codebase is
 completely useless as you can't run it on the client.  Which is why
Emscripten
 is such an amazing technology.  I expect it to get faster with time,
especially
 as JS itself evolves, eliminating more bottlenecks.  And do not forget
that
 Emscripten is not just a C++ to JS compiler.  It's an LLVM bitcode to JS
 compiler.  So it can potentially allow deployment of code written in any
 language.

Going WAY off topic, but: 

If they can convert LLVM to Javascript, why can't they convert to a JVM
bytecode for Android, etc?   Sounds like a great project!  

Regards, 

Tony


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QScriptProgram and multi-threading

2013-01-21 Thread Tony Rietwyk

 Sent: Monday, 21 January 2013 11:32 PM
 
 Hi all.
 
 I have written a multi-threaded program (Qt 4.8.3) that executes QtScript
 code in multiple threads, each thread with its own QScriptEngine. The
script
 code is wrapped in QScriptProgram object.
 
 Is the same QScriptProgram object supposed to be usable in multiple script
 engines concurrently? If the answer is yes, I think I found a bug, because
it
 seems that this is not the case. (I'm happy to file a bug report then). If
the
 answer is no, the API documentation of QScriptProgram and QScriptEngine is
 misleading and should be updated.
 
 To find the root cause for the problem, I tried to analyze the threads
using
 Helgrind, and it spits out a lot of errors like the following:
 http://img145.imageshack.us/img145/9094/helgrind.png
 
 This seems to be consistent with what I see in the debugger: When my
 application crashes, at least one of the threads almost always is in the
control
 path of some JIT-related functions of the JS engine.
 
 Any thoughts would be welcome.
 
 -Christian

Hi, 

I don't see anything in the 4.8.4 docs to suggest they can be shared between
threads.   Even though they might be executing the same program script, I
think you'll need to create a separate one for each thread.  

Tony


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Best way to QObject-wrap simple objects

2013-02-19 Thread Tony Rietwyk
Hi Frank, 

 Sent: Wednesday, 20 February 2013 12:19 AM
 
 Hello List!
 
 Sometimes I have a simple class, maybe a POD, that I want to pump through
 a queued signal-slot connection.  As I understand it, I need a QObject to
do
 that.  So I wrap my class in QObject.

You can pass pointers to the POD without doing anything else: 

signals:
void my_signal(POD *data);

If it really must be POD by value, then use Samuel's approach. 

Tony.


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Globally Converting QTapAndHoldGesture to Mouse Double Click

2013-02-21 Thread Tony Rietwyk
Hi Josh, 

I think most widgets are expecting Press, Release, DoubleClick, Release
sequences.  

In my own code, I've had to set a flag on the double-click, then action it
on the following release.   This was where the double-click was to open
another dialog.  Without this, the release would trigger a click in the new
form, which the client did not want to occur.  

Maybe QInputMethod might be more appropriate in your case? 

Hope that helps. 

Tony


 Sent: Friday, 22 February 2013 4:36 PM
 
 Hello all,
 
 I'm trying to write a global proceedure to convert all QTapAndHoldGesture
 events to mouse double click events. I thought this should be trivial, but
it's
 really stumping me.
 
 I setup an event filter globally for my QApplication and grab the gesture
as
 follow:
 app.installEventFilter(myobj);
 mainWin-grabGesture(Qt::TapAndHoldGesture);
 
 And then I have an event filter as follows:
 
 bool myObject::eventFilter(QObject *obj, QEvent *e)
 {
if(e-type() == QEvent::Gesture)
{
  QGestureEvent *event = static_castQGestureEvent*(e);
  if(QGesture *gest = event-gesture(Qt::TapAndHoldGesture))
  {
QTapAndHoldGesture *tah = static_castQTapAndHoldGesture *(gest);
QMouseEvent dblClk(QEvent::MouseButtonDblClick, tah-
 position().toPoint(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
QApplication::sendEvent(obj, dblClk);
return true;
  }
}
 }
 
 I receive the gesture events fine, but for some reason when none of my
 widgets receive the double click events. I've tried lots of different
 options for instantiating my QMouseEvent. I've tried calling grabMouse on
 the widget before sending the event, but still nothing receives double
 click events. Does anyone have an idea of why none of my widgets receive
 the double click events?
 
 Thanks!
 
 Josh


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Access forms from an called class?

2013-03-04 Thread Tony Rietwyk
 Sent: Tuesday, 5 March 2013 3:08 AM
 
 OK, I did that and I finally got the btle class returning the data. I must
say
 though, I am not at all convinced this is a great way of doing it, because
now
 I'll have a couple of hundred routines in the main class that deal with
 decoding each message that's passed back. I can't pass a generic message
 back, because different BTLE messages contain different sorts of data that
 need to be dealt with in their own way. It seems to me a much nicer way to
 do this would be in the btle class and not clutter up the MainWindow.
 
 I'm probably misunderstanding something or just going about this in
totally
 the wrong way though. :~/

Hi Robert, 

Unfortunately, there is really no way around matching complicated data to
UI, unless you add a modelling layer.   That would give you other benefits
like saving and restoring data, but it takes at least as much code anyway.  

In our case we had 70 different exam questions, each with different data and
each requiring 2 dialogs.  We used separate classes for each with a
registration system and virtual methods to create, load, show, scrape and
save each dialog. 

We also used a designer plugin to add composite widgets for common data
groups across the question types.   This makes designing the UI much easier.


Hope that helps, 

Tony


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] ´ð¸´: how to block run function of QRunnable class

2013-03-18 Thread Tony Rietwyk
Hi Ken,

 

In Qt 4, you have to define your own override of QThread and expose the 
protected static sleep methods.   I'm don't know about Qt 5. 

 

Tony

 

 

From: interest-bounces+tony=rightsoft.com...@qt-project.org 
[mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf Of 
pengliang(??)
Sent: Tuesday, 19 March 2013 4:22 PM
To: Amogh Kudari
Cc: Interest@qt-project.org
Subject: [Interest] 答复: how to block run function of QRunnable class

 

Hi

 Thank you.

But I check source code of Qt, QthreadPool is derived from Qobject, not Qthread.

 

 

Thanks

Ken

 

 

 

  _  

发件人: Amogh Kudari [mailto:amogh.kuda...@gmail.com] 
发送时间: 2013年3月19日 11:53
收件人: pengliang(彭亮)
抄送: Interest@qt-project.org
主题: Re: [Interest] how to block run function of QRunnable class

 

Hi Pengliang,

 

  I am not pretty sure but it may be possible as QThreadPoolThread is a 
friend class of Qrunnable class and 

QThreadPoolThread is derived from QThread and QThread has the sleep method.

Hope this helps.

 

Regards,

Amogh.

 

On Tue, Mar 19, 2013 at 8:11 AM, pengliang(彭亮) pengli...@founder.com wrote:

Hi all

 I don’t know how to block run function several seconds of Qrunnable 
class.

 

Andybody know?

 

 

Thanks

Ken

 

 


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

 

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] ´ð¸´: how to block run function of QRunnable class

2013-03-19 Thread Tony Rietwyk
Hi Ken, 

 

Sorry for the confusion - deriving from both QRunnable and QThread is probably 
NOT a good idea - you don't want to create your own QThread - just access the 
static methods: 

 

// Hack to get around Qt strictness...

class TSleepThread: public QThread

{

public:

  static void sleep(unsigned long secs) { QThread::sleep(secs); };

  static void msleep(unsigned long msecs) { QThread::msleep(msecs); };

  static void usleep(unsigned long usecs) { QThread::usleep(usecs); };

};

 

then in your QRunnable derived class: 

 

  ...

  TSleepThread::msleep( 20 );

  ...

 

Regards, 

 

Tony

 

 

From: pengliang(??) [mailto:pengli...@founder.com] 
Sent: Tuesday, 19 March 2013 4:46 PM
To: Tony Rietwyk; interest@qt-project.org
Subject: ??: [Interest]´ð¸´: how to block run function of QRunnable class

 

Hi

I have defined a class derived from Qrunnable and Qthread.

Now, i call sleep in run function, it worked perfect.

 

Thanks

Ken

 

 

  _  

发件人: interest-bounces+pengliang=founder@qt-project.org 
[mailto:interest-bounces+pengliang=founder@qt-project.org] 代表 Tony Rietwyk
发送时间: 2013年3月19日 13:36
收件人: interest@qt-project.org
主题: Re: [Interest]´ð¸´: how to block run function of QRunnable class

 

Hi Ken,

 

In Qt 4, you have to define your own override of QThread and expose the 
protected static sleep methods.   I'm don't know about Qt 5. 

 

Tony

 

 

From: interest-bounces+tony=rightsoft.com...@qt-project.org 
[mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf Of 
pengliang(??)
Sent: Tuesday, 19 March 2013 4:22 PM
To: Amogh Kudari
Cc: Interest@qt-project.org
Subject: [Interest] 答复: how to block run function of QRunnable class

 

Hi

 Thank you.

But I check source code of Qt, QthreadPool is derived from Qobject, not Qthread.

 

 

Thanks

Ken

 

 

 

  _  

发件人: Amogh Kudari [mailto:amogh.kuda...@gmail.com] 
发送时间: 2013年3月19日 11:53
收件人: pengliang(彭亮)
抄送: Interest@qt-project.org
主题: Re: [Interest] how to block run function of QRunnable class

 

Hi Pengliang,

 

  I am not pretty sure but it may be possible as QThreadPoolThread is a 
friend class of Qrunnable class and 

QThreadPoolThread is derived from QThread and QThread has the sleep method.

Hope this helps.

 

Regards,

Amogh.

 

On Tue, Mar 19, 2013 at 8:11 AM, pengliang(彭亮) pengli...@founder.com wrote:

Hi all

 I don’t know how to block run function several seconds of Qrunnable 
class.

 

Andybody know?

 

 

Thanks

Ken

 

 


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

 

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QSqlTableModel - table name issue in Postresql

2013-04-07 Thread Tony Rietwyk
Hi Muhammad, 

 

I don't know Postgresql at all.   I believe it is based on Oracle.   Your 
problem sounds like the table name was quoted in the create statement, leading 
to the mixed-case table name being stored in the database.   After that you 
must always quote the table name in any sql, otherwise it gets converted to 
uppercase, and doesn't match.  

 

What was the create statement used for the table?  

 

What is the exact error message you are getting back?  

 

Tony.

 

 

 

From: interest-bounces+tony=rightsoft.com...@qt-project.org 
[mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf Of M. 
Bashir Al-Noimi
Sent: Monday, 8 April 2013 1:44 AM
To: Sviatoslav Feshchenko; interest@qt-project.org
Subject: Re: [Interest] QSqlTableModel - table name issue in Postresql

 

Some how this issue is related but not directly.

Does any one has an idea how to pass table name directly as string?

 

On Sat, Apr 6, 2013 at 3:58 PM, Sviatoslav Feshchenko sviatos...@outlook.com 
wrote:

See if your issue is related to QTBUG-30076 
https://bugreports.qt-project.org/browse/QTBUG-30076 

 

 

On 2013-04-06, at 8:30 AM, Muhammad Bashir Al-Noimi mbno...@gmail.com wrote:

 

Hi All,

 

Recently I noticed that I’ve to add double quotes to table’s name for calling 
Postgresql’s table while it’s not required for MySQL or SQLite tables!!

how can I make QSqlTableModel works in same way for three types of SQL 
databases?

 

Posgtresql:

p_tableModel-setTable(\Persons\);

 

MySQL  SQLite:

p_tableModel-setTable(Persons);
-- 
Best Regards,
Muhammad Bashir Al-Noimi

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] Building qt4 on mac with -no-webkit

2013-04-19 Thread Tony Rietwyk
Hi Everybody, 

It seems this is not possible,  -no-webkit is marked as Windows only in the
configure options docs,  why is that?  If Qt was smart enough to link to the
system webkit on Mac, it might make sense, but that doesn't happen.  

I would like to distribute my app via the Apple app store without qtwebkit,
and with qtassistant using QTextBrowser.  This combination works well on
Windows, yet QtAssistant will not build if -no-webkit is specified on the
configure line on Mac.  I have also tried running configure as normal, then
defining QT_NO_WEBKIT, and re-running the assistant makefile with -B.  The
assistant runs but still uses webkit.  I can tell that since our help css
has first-child selectors in it, and they are working on Mac, but on Windows
QTextBrowser ignores them. 

As a last resort, I could hack the supplied the assistant.pro to force it to
use QTextBrowser. 

I am using Qt 4.8.4, and gcc shows i686-apple-darwin11-llvm-gcc-4.2 on OSX
10.7.5. 

Thanks for any suggestions! 

Tony


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QCompleter::currentIndex issue

2013-04-21 Thread Tony Rietwyk
Hi Muhammad, 

 

I haven't used QCompleter, and I agree that the documentation is vague and 
crying out for a diagram.  From my reading, the currentIndex only relates to 
the proxy completionModel, not your original model.   Nowhere does it show how 
to get the matching entry in your model.  I assume you will have to cast the 
completionModel to QAbstractProxyModel to map the indexes to your model.  

 

Hope that helps, 

 

Tony

 

 

From: interest-bounces+tony=rightsoft.com...@qt-project.org 
[mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf Of 
Muhammad Bashir Al-Noimi
Sent: Sunday, 21 April 2013 12:43 PM
To: interest@qt-project.org
Subject: [Interest] QCompleter::currentIndex issue

 

Hi,

I set QCompleter to QLineEdit object… it works fine but I can’t get the current 
index from QCompleter by currentIndex() because it always return 0 for row 
index.

PS
I call currentIndex() from QLineEdit editingFinished() slot.



void MainWindow::on_lineEdit_find_editingFinished()
{
if (p_db.isOpen()) {
/*! \bug Set current row from the completer
 */
ui-tableView_table-setCurrentIndex(completer-currentIndex());
qDebug()  completer-currentIndex().row();
}
}





-- 
Best Regards,
Muhammad Bashir Al-Noimi
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Building qt4 on mac with -no-webkit

2013-04-21 Thread Tony Rietwyk
Thanks for the response Mike, 

My configure used against expanded qt-everywhere-commercial-src-4.8.4.tar.gz
is:

./configure -arch x86 -no-qt3support -no-webkit   -nomake examples -nomake
demos  -sdk
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Develop
er/SDKs/MacOSX10.6.sdk

- The configure shows the makefile for webkit being generated
- webcore, etc modules are built by make
- assistant.pro forces the use of helpviewer_qwv.cpp which uses webkit.  

Very strange! 

I've tried Philippe's suggestion to remove webkit from src/3rdparty before
configure with -no-webkit, but that crashes early in make trying to do qmake
on webkit.pro after forcing the src/3rdparty/webkit to be created!?  

I spoke too soon about my hacked assistant.pro working - it builds, but it
seems there are lots of problems with the body font and line sizing issues
using QTextBrowser on Mac?  

Regards, 

Tony

 Sent: Sunday, 21 April 2013 11:53 PM
 
 This is what I use on OS X 10.6.8 and 10.8 builds using the Qt 4.8.4
 everywhere source package.
 
 ./configure -opensource -nomake demos -nomake examples -debug-and-
 release -shared -fast -exceptions -stl -no-qt3support  -no-webkit -no-
 phonon -largefile -arch x86_64  -prefix /Users/Shared/Toolkits/Qt-4.8.4 -
 Dmmacosx-version-min=10.6
 
 And I definitely do NOT get WebKit built and it builds just fine. From
what I
 can tell.
 
 Mike Jackson
 
 On Apr 20, 2013, at 12:16 AM, Tony Rietwyk t...@rightsoft.com.au wrote:
 
  Hi Everybody,
 
  It seems this is not possible,  -no-webkit is marked as Windows only
  in the configure options docs,  why is that?  If Qt was smart enough
  to link to the system webkit on Mac, it might make sense, but that
doesn't
 happen.
 
  I would like to distribute my app via the Apple app store without
  qtwebkit, and with qtassistant using QTextBrowser.  This combination
  works well on Windows, yet QtAssistant will not build if -no-webkit is
  specified on the configure line on Mac.  I have also tried running
  configure as normal, then defining QT_NO_WEBKIT, and re-running the
  assistant makefile with -B.  The assistant runs but still uses webkit.
  I can tell that since our help css has first-child selectors in it,
  and they are working on Mac, but on Windows QTextBrowser ignores them.
 
  As a last resort, I could hack the supplied the assistant.pro to force
  it to use QTextBrowser.
 
  I am using Qt 4.8.4, and gcc shows i686-apple-darwin11-llvm-gcc-4.2 on
  OSX 10.7.5.
 
  Thanks for any suggestions!
 
  Tony
 
 
  ___
  Interest mailing list
  Interest@qt-project.org
  http://lists.qt-project.org/mailman/listinfo/interest
 
 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Building qt4 on mac with -no-webkit

2013-04-22 Thread Tony Rietwyk
Thanks Israel, 

I have done that for my application.  The problem is that it also uses
Assistant, which on Mac requires webkit.  

It's pretty silly - there doesn't seem to be a supported way of stopping
webkit from being in QT_CONFIG on Mac!  

Regards, 

Tony

 Sent: Tuesday, 23 April 2013 1:56 AM
 
 If your goal is simply to get an app into the mac app store without using
 webkit, there is no need to build Qt without webkit - simply don't use
webkit
 in your project. I have several Qt based apps in the app store, not using
 webkit, even though I built qt with webkit. At least, I'm fairly sure they
don't
 include webkit :-)
 
 Israel Brewster


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] gradients and Layouts ...

2013-04-30 Thread Tony Rietwyk
Hi Laura, 

 

A Qt layout is not a widget, so it can't draw anything itself.   I would use
a QFrame with the style set to draw the background gradient, then add the
layout and child widgets.  

 

Hope that helps, 

 

Tony

 

 

From: interest-bounces+tony=rightsoft.com...@qt-project.org
[mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf Of
Laura Rodríguez Pérez
Sent: Wednesday, 1 May 2013 12:21 AM
To: interest@qt-project.org
Subject: [Interest] gradients and Layouts ...

 

Hi … I’m interested in creating a QT Layout with a gradient background in
the same manner as the QTCreator section headers ( the ones with the black
gradients ).  I’m currently diggin’ through the documentation but haven’t
been able to come up with anything related …

 

Can you point me in the right direction ??

 

Thanks …

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] TableWidget size dynamically

2013-05-15 Thread Tony Rietwyk
Have you tried QHeaderView.setResizeMode(int, ResizeMode)?  

 

Note there may be issues depending on the order in which you set the
columns.  I found I had set all of the fixed columns before setting any
stretchable ones. 

 

Tony

 

 

From: interest-bounces+tony=rightsoft.com...@qt-project.org
[mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf Of
Sujan Dasmahapatra
Sent: Wednesday, 15 May 2013 8:09 PM
To: interest@qt-project.org
Subject: [Interest] TableWidget size dynamically

 

I got a QTableWidget with 3 columns in it. How can I resize the columnwidth
based on resizing my MainWindow. Currently I have set a fixed width for
column using

 

ui.TableWidget-setColumnWidth(0,200);


ui.TableWidget-setColumnWidth(1,200);

ui.TableWidget-setColumnWidth(2,200);

 

Any help is highly appreciated.

-- 

Thanks  Regards

Sujan

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Q_PROPERTY notification across processes?

2013-05-16 Thread Tony Rietwyk
Hi Charley, 

 

You didn't say which type of systems this will be running on? 

 

What about QtDBus using a direct connection between the applications,
instead of the system-wide bus?  

 

Even if that doesn't work for you, it has solved many of the same problems,
and needed over 20,000 lines of code! 

 

Regards, 

 

Tony

 

 

From: interest-bounces+tony=rightsoft.com...@qt-project.org
[mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf Of
Charley Bay
Sent: Friday, 17 May 2013 11:27 AM
To: Qt Interest
Subject: [Interest] Q_PROPERTY notification across processes?

 

I have a C++ QObject-derived class that exposes properties for use in QML,
works fine (Qt5).

 

WHAT I WANT:

 

I would like to instantiate an instance of this class in each of two
processes, where changes in one notifies the other (in the other process).
This is logically something like local-instance-reflection to a remote
instance in a remote process.

 

(I could create a second class-type if needed, but current implementation
suggests I could instantiate the same class type on each side.)

 

My current thoughts are to use a socket between the two processes, where
the objects agree on a unique identifier that represents that
reflected-instance in each process.  Then, the implementation would
trigger onChange operations in the remote-instance from property-changes
in the local-instance.  There would be many of these reflecting-pairs.

 

This implementation-plumbing would probably be through some C++
implemented dispatcher, where one would be instantiated in each process, and
be responsible for the serialization for state-changes/notifications between
the processes (read/write), and routing the notification to the object in
the local process.

 

A concern I have is that there will be *many* of these pairs (thousands,
possibly tens-of-thousands), and I don't know if the approach would
scale-well for lots of notifications.

 

Does this design seem reasonable?

 

Do you have thoughts on an alternative?

 

It seems like the Q_PROPERTY notification through QML would be an
interesting mechanism to enable this generic-cross-process
event-based-synchronization.

 

I can't use shared memory, as these processes will typically be on different
machines.

 

--charley

 

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] change of only one tab in QTabWidget

2013-05-18 Thread Tony Rietwyk
You can always pad the text with spaces to get an approximate result. 

 

Tony.

 

 

From: interest-bounces+tony=rightsoft.com...@qt-project.org
[mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf Of
Sujan Dasmahapatra
Sent: Saturday, 18 May 2013 10:54 AM
To: interest@qt-project.org
Subject: [Interest] change of only one tab in QTabWidget

 

How can I change the width of only one tab in QTabWidget?. With the below
code all tabs width is changing.

setStyleSheet( 

QTabBar::tab { width: 25px; height:  + QString::number(eachTabHeight) +
px; }

);

I want to change the width of one particular tab say for index 2. Please let
me know if it's possible. Any help is appreciated.

-- 

Thanks  Regards

Sujan

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QGroupBox Subclass

2013-05-21 Thread Tony Rietwyk
 Sent: Tuesday, 21 May 2013 11:32 PM
 
 I am currently using a QGroupBox (with some custom style sheets) as a
 superclass for a custom widget in our program. QGroupBox has the
 isCheckable property which we use then style with a custom image for an
 icon and over ride the toggled to get some custom actions when the user
 clicks the button. We would like to be able to add a few more buttons to
 the QGroupBox to perform some other actions. I took at the source code for
 QGroupBox to try and figure out where the layout was being performed and
 I would have to say I understand generally what is going on but I can not
 figure out where the actual QCheckBox is being added to the layout for
the
 QGroupBox.
 
   My Question is: Could some nice developer just give me a nudge in the
right
 direction as to where the actual layout of the QGroupBox is being
performed
 and where the QCheckBox is instantiated? I think I can figure it out from
 there.
 
 Thanks so much.
 
 Mike Jackson (dream3d.bluequartz.net)

Hi Mike, 

There is no QCheckBox child.  The checkbox is drawn and handled in
conjunction with the style as a QStyle::SubControl.  See QGroupBox.event for
the details (around line 330 in 4.8.4).   I think you need to override
QProxyStyle to force extra space between the existing checkbox and label.  

Please let the list know how you go, as I may need to do something similar
myself.  

Regards, 

Tony


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] Target machine not set in projects generated by qmake for Visual Studio

2013-06-02 Thread Tony Rietwyk
Hi Everybody! 

When I build my Qt 4.8.4 projects on Windows 7, I always get this warning: 

LINK : warning LNK4068: /MACHINE not specified; defaulting to X86

and later: 

project_name - 0 error(s), 1 warning(s)

which sucks.   I have tried changing mkspecs/win32-msvc2008/qmake.conf to
include /MACHINE:X86 in QMAKE_LFLAGS, which works well for the moment.   It
will need changing once we go to X64 builds.  

How should I specify this in the qmake.conf file so that X32 or X64 builds
are generated correctly by qmake?  

Thanks. 

Tony


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Target machine not set in projects generated by qmake for Visual Studio

2013-06-03 Thread Tony Rietwyk
Thanks Ben, that was the clue I was looking for.  

Tony

 Hi Tony,
 
 This is how I modified the .pro files of my projects:
 
 win32 {
   contains(QMAKE_HOST.arch, x86_64) {
 QMAKE_LFLAGS += /MACHINE:X64
   } else {
 QMAKE_LFLAGS += /MACHINE:X86
   }
 }
 
 IIRC this selects X64 if you run Windows 64 bit. You would have to omit
the
 check if you only want 32 bit builds now. I don't know how you select this
 setting depending on the Qt libraries you use for a given build.
 
 Hope it helps,
 
 
   Ben


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Terminating a QThread

2013-06-21 Thread Tony Rietwyk
But a bool value can be cached indefinitely, so make sure you declare the flag 
as volatile!  

 

Tony

 

 

From: interest-bounces+tony=rightsoft.com...@qt-project.org 
[mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf Of 
Etienne Sandré-Chardonnal
Sent: Friday, 21 June 2013 9:01 PM
Cc: interest@qt-project.org
Subject: Re: [Interest] Terminating a QThread

 

Sorry Mandeep, I didn't read your post first. Basically what I posted is 
similar.

A mutex is a little bit overkill here, you could use an atomic variable if you 
want to be sure, but just a bool flag will be enough as it is always set 
atomically AFAIK

 

2013/6/21 Mandeep Sandhu mandeepsandhu@gmail.com

On Fri, Jun 21, 2013 at 1:36 PM, francois cellier f_cell...@yahoo.fr wrote:

Dear all,

Even if I know that it can be dangerous to terminate a thread, I need to do it 
for my application.
The function that run into the thread is like a long linear sequence of code 
that has not been designed in a signal/slot way. Moreover, in my thread, I need 
an eventloop as I use in it some TCP or UDP  Qt sockets.

I have tried the worker approach with the following code and I did not find a 
way to terminate the thread :

For my thread class :

1.  ThreadEx::ThreadEx(QObject http://qt-project.org/doc/QObject.html  
*parent) :

2.  QThread http://qt-project.org/doc/QThread.html (parent)

3.  {

4.  }

5.   

6.  void ThreadEx::run()

7.  {

8.  QThread http://qt-project.org/doc/QThread.html 
::setTerminationEnabled(true);

9.  exec();

10. }



For my worker class:

1.  ObjectInThread::ObjectInThread(QObject 
http://qt-project.org/doc/QObject.html  *parent) :

2.  QObject http://qt-project.org/doc/QObject.html (parent)

3.  {

4.  }

5.   

6.   

7.  void ObjectInThread::run()

8.  {

9. int compteur = 0;

10. //here i am using a loop instead of the long linear flow  but it is not 
a loop  in the real code

11. while(1)

12. {

13. qDebug() compteur;

14. compteur++;

15. Sleep(1000);

16. }

17. }

You use a condition variable in your loop here, which will exit out of the 
run() function. This variable can be set from your stop() slot (protected by a 
mutex if needed).

In your main(GUI) thread you can wait for your worker thread to exit:

m_thread-quit();
m_thread-wait();

 

HTH,

-mandeep

 

This should cleanly exit the thread.
 

Moreover I tried the other way of using QThread that consists in inheriting the 
QThread class and overriding the run method with the code :

void ThreadEx::run()
{
int compteur = 0;
while(1)
{
 qDebug() compteur;
 compteur++;
 sleep(1);
}
}

In that case terminate works but I do not have an eventloop as I did not call 
the exec method.

Is this the expected behaviour ?

I am using Qt5.1 on centOS / RedHat 6.2. I have also tried this on Windows with 
no more success.

Thanks for your help,

François

 

 

 

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

 


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

 

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Glueing widgets together

2013-06-28 Thread Tony Rietwyk
Hi Sensei, 

 

I have a master dialog with a slave dialog attached to one border.  This was
done using eventFilter in the slave to listen to the master Move and Resize
events - not MouseMove.  It's only 10 lines of code, works well and there is
no jerkiness.  It put the code in the slave, since it can be attached to
many different dialogs in my app.  

 

The same code should work for peer dialogs - but you must be careful to
prevent recursion by settings flags in the other dialog before moving it so
it doesn't try to move the first one.  The recursion could cause the delays
and high CPU usage.  

 

Can you show the code that isn't working?  

 

Tony.

 

 

From: interest-bounces+tony=rightsoft.com...@qt-project.org
[mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf Of
Sensei
Sent: Friday, 28 June 2013 5:18 PM
To: interest@qt-project.org
Subject: [Interest] Glueing widgets together

 

Dear all,

 

I've posted some time ago a question about moving widgets simultaneously.
However, the proposed solutions were unsatisfactory. 

 

That is probably because I've expressed my needs in a non useful way. So
here it goes. 

 

I need to glue together two widgets, so that when one moves, the other
*simultaneously* moves. 

 

They should appear glued even when dragging around, fast and slow. Like if
the follower is simply painted over the moving widget. 

 

The proposed solutions involve getting the mouse move events dealt with.
This resulted in a visible delay, and that isn't what I want: I don't want
to see the window moving with the follower staying still, and after few
instants, the follower (disappearing from where it was) painted in the right
position. 

 

Is there any way I can achieve this visual effect?

 

Thanks  Cheers!

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QWindow::setTransientParent fails on windows

2013-09-25 Thread Tony Rietwyk
Hi Roland, 

 

I'm not sure what you are trying to achieve,  but I had a similar problem
with the splash screen appearing with its own task bar tab.   I worked
around the problem by doing:

 

  int exstyle = GetWindowLong( mpSplash-winId(), GWL_EXSTYLE );

  SetWindowLong( mpSplash-winId(), GWL_EXSTYLE, 

exstyle  ~WS_EX_TOOLWINDOW );

 

before showing the splash.  

 

Hope that helps, 

 

Tony

 

 

From: interest-bounces+tony=rightsoft.com...@qt-project.org
[mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf Of
Roland Winklmeier
Sent: Thursday, 26 September 2013 2:34 AM
To: interest@qt-project.org
Subject: [Interest] QWindow::setTransientParent fails on windows

 

Hi there,

I'm currently struggling with QWindow::setTransientParent on a windows
platform. I have two different windows and want to set one as the child of
the other. Using QWindow::setParent() was not successful, because it was
embedded into the parent (I got the parent QWindow* by calling fromWinID() )

If I call QWindow::setTransientParent(parent), nothing changes. I have two
different entries in the taskbar instead of one and both windows are still
parentless.
After looking into the code in the windows platform plugin, I found out that
the following method is called in qwindowswindow.cpp:

void QWindowsWindow::updateTransientParent() const. 

This method sets the parent by setting GWL_HWNDPARENT. But MSDN explicitly
said, you should NOT do it this way:

You must not call SetWindowLong with the GWL_HWNDPARENT index to change the
parent of a child window. Instead, use the SetParent function. 
Source:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms633591%28v=vs.85%2
9.aspx

So I assume this should be changed in the windows platform plugin to be a
real parent? Are there any other options to set the parent without embedding
it?

Cheers

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QSettings possible bug on Windows

2013-10-01 Thread Tony Rietwyk
Hi Alex, 

 

It certainly looks like it should be found.  It reminds of a security issue
where similar looking unicode characters in folder names were used to scam
people.  Can you hex dump the characters of each entry in your loop?   Maybe
you have a virus that has done something similar?   Or maybe there is an
embedded NULL character?  

 

Hope that helps, 

 

Tony

 

 

 

Sent: Tuesday, 1 October 2013 12:02 PM



Just want to add that key is found,


qDebug()  child keys =reg.childKeys();

result in


child keys =  (Common Administrative Tools, Common AppData, Common
Desktop, Common Documents, Common Programs, Common Start Menu,
Common Startup, Common Templates, CommonMusic, CommonPictures,
CommonVideo, OEM Links, Personal) 

but value returned is empty string - different from visible in regedit 

Alex

 

On Mon, Sep 30, 2013 at 6:24 PM, Alex Malyushytskyy alexmal...@gmail.com
wrote:

I found a problem with QSettings when trying to read from registry.
I am using  Qt 4.7.3 so I would appreciate if anybody can check with Qt 5 at
least. 

Problem:

QSettings fails to return specific key value (Common AppData) when read
other keys at the same level just fine.

Key exists and verified with regedit.

Test case is below:


#include QApplication
#include QSettings
#include QDebug

void ddd2();

int main(int argc, char *argv[])
{

// execute test and return

QApplication a(argc, argv);

ddd2();

 

return 0;

}

void ddd2()
{
QSettings
reg(HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Explo
rer\\Shell Folders, 
QSettings::NativeFormat);
QString key;
QString val;

key = QString(Common AppData);
val = QString ( reg.value(key).toString());
qDebug()  key:   key   value:   val;

key = QString(Common Desktop);
val = QString ( reg.value(key).toString());
qDebug()  key:   key   value:   val;

key = QString(Common Documents);
val = QString ( reg.value(key).toString());
qDebug()  key:   key   value:   val;
}

Output:


key:  Common AppData  value:   
key:  Common Desktop  value:  C:\Users\Public\Desktop 
key:  Common Documents  value:  C:\Users\Public\Documents 

Expected 
 * WinXP: c:\Documents and Settings\All Users\Application Data
 * WinV/7/8: c:\ProgramData



Regards,

   Alex

 

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QTcpServer. Connecting.Sending data.

2013-10-09 Thread Tony Rietwyk
Hi Alexander, 

 

QTcpServer.listen only sets up the listening - it does not wait until a new
connection arrives.   In my code, I only call listen once, then run an event
loop.  The new connections arrive in the incomingConnection slot.  

 

void MyThread::run()

{

srv = new (std::nothrow) tcp_server(ised_win_raw_ptr);

if (!connect(srv,SIGNAL(newConnection(),srv,SLOT(connection())
))  error

if (!srv-listen(QHostAddress::Any, port)) error
exec();
srv-close();
delete srv;

}

 

Of course, you can put the slot anywhere.   The slot uses
nextPendingConnection() to get the socket.  

 

Works well for me.  

 

If you cannot use QThread.exec, then use srv-waitForNewConnection in your
terminate loop.  

 

Tony

 

 

From: interest-bounces+tony=rightsoft.com...@qt-project.org
[mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf Of
Alexander Syvak
Sent: Thursday, 10 October 2013 5:11 AM
To: Qt Interest
Subject: [Interest] QTcpServer. Connecting.Sending data.

 

Hello,

here's the code of the redefined method run() of QThread class =
void run() override 

{
srv = new (std::nothrow) tcp_server(ised_win_raw_ptr);
#ifdef DEBUG
qDebug()  listener's thread =   thread();
#endif
terminate_ = false;
while ( !terminate_ ) if ( !srv-isListening() )
srv-listen(QHostAddress::Any, port);
#ifdef DEBUG
qDebug()  Deleting the ised_tcp_server object.;
#endif
srv-close(); // Closes the server. The server will no longer listen
for incoming connections.
delete srv;
}
The program connects to 9000 port for listening.


Using the netcat command
nc -vv 127.0.0.1 9000
yields
PC_NAME [127.0.0.1] 9000 (?) open


Then I typed start and hit Enter.
The break point has been set in incomingConnection which is redefined
in the tcp_server class inheriting QTcpServer. 


Debugger did not paused in the method body when netcat connected to the
port.
 
 
Solutions?

 

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] How to get word that was clicked on in a table view or table widget?

2013-10-11 Thread Tony Rietwyk
Hi Alexei, 

 

Interesting question.  How does your model get the display text?  I assume
your model (or the QTableWidget model) is storing a QString.  In the cell
click handler you can theoretically: 

 

- push the display text into a QTextEdit (hidden for release builds)

- format it with the same font, margins, etc, as the cell

- set the max width to the cell width

- use cursorForPosition to get a QTextCursor for the mouse offset within in
the cell

- select the current word using select(QTextCursor::WordUnderCursor)

- use selectedText to get the word. 

 

The hard part is mimicking the formatting of the cell, and forcing the text
edit to do its layout changes. 

 

Hope that helps, 

 

Tony.

 

 

From: interest-bounces+tony=rightsoft.com...@qt-project.org
[mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf Of
Alexei Vinidiktov
Sent: Saturday, 12 October 2013 3:44 PM
To: interest@qt-project.org
Subject: Re: [Interest] How to get word that was clicked on in a table view
or table widget?

 

I forgot to mention that the table view or table widget is not editable.

 

On Sat, Oct 12, 2013 at 11:21 AM, Alexei Vinidiktov
alexei.vinidik...@gmail.com wrote:

Hello,

 

I need to get the word that was clicked on in a table widget or table view
cell.

 

Is it possible? If so, how would I do that?

 

Thanks.


 

-- 
Alexei Vinidiktov 





 

-- 
Alexei Vinidiktov 

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Run Console and windows screen

2013-10-28 Thread Tony Rietwyk
Hi Daniel, 

 

Yes it does - you want Visual Studio to debug two separate projects at the
same time?  I don't think it can do that.  

 

To just run both exe's, you could modify the window project to run a batch
or script file that runs both exe's, but I'm not sure debugging will work in
that case.  Hint:  See Debugging / Command in the project options.  If you
generate the VS project from a .pro via qmake, then you will probably need
to modify the project each time it is regenerated.  

 

Hope that helps, 

 

Tony

 

 

From: Daniel Mota [mailto:danielmota.produ...@gmail.com] 
Sent: Monday, 28 October 2013 8:00 AM
To: Tony Rietwyk
Cc: Qt-interest
Subject: Re: [Interest] Run Console and windows screen

 

Hi Tony!

 

I think by answering you, I may give some clarification to Frank as well.

 

I already have the console application running. (actually, it is giving me
good benchmark results)

 

In another project, I already have the windows application running as well
(is not very fancy, but it is nice!).

 

but I could not find a way to put both working together, what means... OR I
can see the paths being updated, OR I can see the COUT  printed in the
screen, but I could not find a way to see the paths being linked, and the
console giving me information at the background.

 

Is it better now?

 

Once again, thanks a lot guys!

 

 

Daniel 

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Get the username:password part of a HTTP request from QTcpSocket

2013-12-01 Thread Tony Rietwyk
Hi Konrad / Lucas

 -Original Message-
 Sent: Monday, 2 December 2013 7:27 AM
...
 In short: if you do not have the need to access every bit directly use an
 existing server implementation and an easier way to communicate with it.
 For example Apache has modules for the FCGI and SCGI protocols. In this
 case Apache handles the complexities of HTTP while you just have to handle
 a significantly simpler protocol.
 
   Konrad

Or keep your existing QTCPServer based code.  Then use Apache as the
front-end, and proxy to your backend server.  Very straight-forward.  

Regards, 

Tony



___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Unable to create QDialog popup with resizeable border but no title bar

2014-01-20 Thread Tony Rietwyk
Hi Philipp, 

 

Have you tried adding Qt::CustomizeWindowHint without Qt::WindowTitleHint in 
your window flags?  

 

Regards, 

 

Tony

 

 

Sent: Tuesday, 21 January 2014 9:27 AM



In Win32 thats pretty easy to achieve. However I found no way to create a 
resizable popup dialog in Qt. Specifying the Popup style does not even generate 
the WM_NCHITTEST Win32 messages I would need to add resizing behaviour. But I 
would also be happy to use the system provided thick resize frame for QDialog, 
but there seems to be no way to force a QDialog, which is not a QWindow 
subclass to have such frame and no title bar. I tried the FramelessWindowHint, 
to no avail.

 

Any ideas?

 

I need the popup style, cause it guarantees easy dismissal of the popup when 
the popup is not the active window anymore.

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Unit test with multiple data

2014-01-27 Thread Tony Rietwyk
Hi Soroush, 

 

I hit the same problem, and used this: 

 

// Can't use QTEST_MAIN, since we have our own parameters as well. 

// QTEST_MAIN( TTestPitchXml )

 

int main(int argc, char *argv[])

{

#ifdef QT_GUI_LIB

QApplication app(argc, argv);

QTEST_DISABLE_KEYPAD_NAVIGATION

#else

QCoreApplication app(argc, argv);

#endif

TTestPitchXml tc;

QStringList args( app.arguments() );

tc.checkArgs( args );

return QTest::qExec(tc, args);

}

 

Hope that helps, 

 

Tony

 

 

From: interest-bounces+tony=rightsoft.com...@qt-project.org 
[mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf Of 
Soroush Rabiei
Sent: Sunday, 26 January 2014 6:22 AM
To: interest
Subject: [Interest] Unit test with multiple data

 

Hi

 

I'm writing a test unit using Qt's QtTest library. My test case requires three 
strings (database host, username and password) that they should be passed in 
command line.


Documentation says data is passed to test unit in the following syntax:

testname [options] [testfunctions[:testdata]]... 

 

How can I pass more that one `testdata' to a test function? I've tried 
something like:

 

testname testfunctions:data1:data2:data3

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QMdiSubWindow doesn't adjust its size

2014-02-04 Thread Tony Rietwyk
Hi John, 

 

In the top level layout in the QMdiSubWindow, what is the sizeConstraint set
to?   Try Fixed.  

 

Hope that helps, 

 

Tony

 

 

 

From: interest-bounces+tony=rightsoft.com...@qt-project.org
[mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf Of
John Weeks
Sent: Wednesday, 5 February 2014 5:42 AM
To: Interest@qt-project.org Interest
Subject: [Interest] QMdiSubWindow doesn't adjust its size

 

I have a moderately complex compound widget contained within a
QMdiSubWindow. Certain user actions may cause the widgets to change size.
Since everything is contained within layouts, I would expect the
QMdiSubWindow to adjust its size, but it doesn't.

 

Initial appearance:



 

A user action causes changes:



 

I find that if I add a call to this code after any action that might change
the sizes of the widgets it works correctly:

  IgorApp()-processEvents(QEventLoop::ExcludeUserInputEvents);
  infoWindow-rootWidget()-adjustSize();
// rootWidget() returns a pointer to the QMdiSubWindow widget

 

Without the call to processEvents() it doesn't adjust correctly.

 

If the application is run as a SDI application (the window shown above is
then a top-level window) it works correctly.

 

Yes, it's a frameless window. That doesn't seem to affect the behavior.

 

I can create a very simple application with QMdiSubWindow that exhibits this
behavior. I don't think it's caused by forgetting to enclose something in a
layout at some level. A QMdiSubWindow, when resized adjusts the size of its
internal widget. But the internal widget changing size doesn't seem to be
noticed by QMdiSubWindow.

 

1) Is there a way to get a QMdiSubWindow to automagically adjust to its
internal widget? It would be better to not have to sprinkle that bit of code
all over the place.

2) What is processEvents() doing? Why is it necessary?

 

3) I don't like sprinkling calls to processEvents() all over my code. Is
there some other way to achieve this?

 

Thanks for any insight you can provide.

 

-John Weeks

 

image001.pngimage002.png___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Compile Speed Question regarding MOC

2014-02-18 Thread Tony Rietwyk
Mike wrote:

 Sent: Wednesday, 19 February 2014 9:05 AM
 
 I have what seems to be an obvious question/answer but the subtleties may
 not be what I think they are. We have a project with about 500 files most
of
 which inherit from QObject or QWidget which means they all have moc run
 on them. Currently I have each moc created file compiled as a separate
 object which means for every class I have I am really compiling 2 files
(.cpp
 and moc.cxx). The compile times are starting to get up there a bit
and
 I was wondering what others do at this point? Do you simply do the
#include
 moc_MyClass.cxx in the .cpp file of MyClass? Does that really help speed
 up the compile process? Before I go updating all of our source files I
just
 wanted to get a quick sanity check for this course of action from the Qt
 community.
 
 Thanks for any advice.
 Mike Jackson

I had the same problem, and use qmake to generate VS, XCode and Make
projects.  I noticed the Qt sources include the moc in each .cpp.   I
changed my code to do the same and it works well.   The qmake utility
recognises this and does not create a separate compile step for them.   Of
course the real solution is to get a faster machine.  

Regards, 

Tony


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Finished resizing a window?

2014-02-24 Thread Tony Rietwyk
Hi John, 

 

I would suggest a short single-shot timer roughly:

 

resizeEvent

base::resizeEvent

if !mTimer.isRunning

mTimer.start

 

paintEvent

if !mTimer.isRunning

base::paintEvent

 

timer slot:

repaint

 

I'm not sure whether overriding the paintEvent is enough to prevent the
child widgets from painting. 

 

Good luck - please let the group know what you decide with this. 

 

Tony

 

 

From: interest-bounces+tony=rightsoft.com...@qt-project.org
[mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf Of
John Weeks
Sent: Tuesday, 25 February 2014 8:56 AM
To: Interest@qt-project.org Interest
Subject: [Interest] Finished resizing a window?

 

We have windows in our application that are potentially expensive to
repaint, so when the user resizes a window we may need to put off repainting
until the resizing is finished. It seems that we don't get mouse down/mouse
up events when the user clicks in the window frame/resize grip area, so I
can't wait until mouse up.

 

Is that correct?

Is there a solution to this?

 

Thanks!

 

-John Weeks

 

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QMessageBox default sizes

2014-04-07 Thread Tony Rietwyk
Hi Sensei, 

In the first statement you are telling the layout to override the minimum
size when it does its calculations.  This means that the second statement is
redundant, since those values will be clobbered by the layout.  

In Qt 4.8.5 I am unable to get the minimum size to work anyway, especially
when the message text is short, and the detail text is long.  The message
box width depends only on the message text, so it appears really narrow.
The detail text is then practically useless.  The size of the box is fixed
and cannot be resized by the user to read the detail text.  

Regards, 

Tony

 -Original Message-
 From: interest-bounces+tony=rightsoft.com...@qt-project.org
 [mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf
 Of Sensei
 Sent: Monday, 7 April 2014 10:28 PM
 To: interest@qt-project.org
 Subject: Re: [Interest] QMessageBox default sizes
 
 On 4/2/14, 2:32pm, Sensei wrote:
  However, I can't set minimum sizes of the dialog with the following:
 
   box_-layout()-setSizeConstraint(QLayout::SetMinimumSize);
   box_-setMinimumSize(400, 150);
 
  Could this be a problem in setting constraints before executing the
dialog?
 
 
 So... any hint on why I can't set my dialog size?
 
 
 
 Thanks  Cheers!
 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Insert without scrolling

2014-04-09 Thread Tony Rietwyk
Hi Hugo, 

Try using an explicit QTextCursor rather than the QTextEdit interfaces. 

Hope that helps, 

Tony


 -Original Message-
 Sent: Thursday, 10 April 2014 2:23 AM
 
 Hi,
 
 I am trying to insert some text at the top of a QPlainTextEdit. To do so
I'm am
 using this lines of code:
 
 ui-textEdit-moveCursor(QTextCursor::Start, QTextCursor::MoveAnchor);
 ui-textEdit-insertPlainText(Some text here);
 
 The problem is that, by doing this, the textEdit is scrolled to the top in
order
 to show the new inserted text.
 
 Is there any way to avoid this scrolling to the top? I need to insert this
text
 silently without the user noticing.
 
 Thanks for your help,


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Off-topic Web / Webkit talk. (But I'l tie it back to Qt)

2014-04-13 Thread Tony Rietwyk
Hi Jason, 

Wt (witty) can run as you describe with your server code bound directly to
WebKit executing the html, css, etc. in a free-standing exe.   But getting
rid of the text and accessing the WebKit objects directly, doesn't really
fix anything!  The functionality of the WebKit objects is still the same -
the same workarounds for different OS's, different CSS standards, different
interpretations of the effects on the box model, and on and on.  So until
someone comes up with a better model of the browser experience, it won't
improve.  Lots of people are trying - Qt with QML, Embacadero's Delphi with
FireMonkey, for example could be candidates.  I can't see how they are going
to replace the existing stack anytime soon - no matter how much people would
like them to! 

Regards, 

Tony.


 -Original Message-
 From: interest-bounces+tony=rightsoft.com...@qt-project.org
 [mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf
 Of Jason H
 Sent: Saturday, 12 April 2014 1:47 AM
 To: Interests Qt
 Subject: [Interest] Off-topic Web / Webkit talk. (But I'l tie it back to
Qt)
 
 I have nothing but contempt for the current state of web development.
 HTML/CSS/JS/DOM/AJAX/MIME, not including your server implementation
 (JS|.NET|Java|PHP) and SQL/NoSQL.  I've been asking the question on why
 we can't migrate HTML,CSS,DOM, and MIME to JSON. It would be a
 monumental effort for little gain.
 
 But I've also been using Witty, a C++ web toolkit that mimics Qt.
Basically, you
 only get push a DIV element (automatic) and the library takes care of the
rest.
 This is a great step in the right direction. But it is still subject to
limitations
 of HTML/CSS/JS/DOM/AJAX/MIME, and the browser implementations
 thereof. (The obsoleting of XP and IE6 and the rejoicing of various web
devs
 at not having to support IE6 is what got me on this particular track.)
 
 In Qt we have a webkit implementation. (I told you I was going to tie it
back
 to Qt ;-) ) Webkit is client-side. What I am thinking is if there was a
server-
 side webkit that communicated directly (or as close to) the client webkit
as
 possible, over say websockets. In my mind, this would get us closer to
using
 Qt for web apps. If we could program Qt with server side webkit objects
(I'll
 call these subclasses of QServerWidgets) so that we can create the widget
 hierarchies which communicate to the standard Webkit client-side
libraries.
 Creating a QServerWidget creates the corresponding WebKit widget. I'm no
 Webkit expert. But I think this would more elegantly
 replace HTML/CSS/JS/DOM/AJAX/MIME, without having to go through
 standards processes. And maybe Webkit is bound
 to HTML/CSS/JS/DOM/AJAX/MIME internally for the time being.
 
 But, in the end, if we handled QWidgets and QServerWidgets the same
 (QPA?) we could code a Qt application and get a web version, a mobile
 version, and a desktop version from the same code base.
 
 I am no means Webkit person, I only have a basic understanding of webkit.
 
 Comments?
 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Fallback fonts embedded for a QtQuick application?

2014-04-20 Thread Tony Rietwyk
Hi Preet, 

 Sent: Sunday, 20 April 2014 4:20 PM
 
 Say I have an application that has a bunch of international unicode text I
need
 to display with QtQuick. I don't necessarily know what the text is going
to be
 in advance but I do have a list of fonts where I'm fairly sure at least
one of
 them has the correct glyphs.
 
 Is there a way to specify a list of fallback fonts to use?
 
 I also specifically want Qt to only look at fonts I package with my
application
 (using QRC).

I don't think you can force Qt to fallback only to QRC fonts - for starters
how would Qt know which paths in your resources have the fonts?

But, you could also store a list of the fonts, and their character ranges.
When you load the texts, check each character is in one of the ranges, then
load the font using QFontDatabase.addApplicationFont.  If a previously
loaded font is no longer required, then removeApplicationFont to conserve
memory. 

Hope that helps, 

Tony


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Qt Plugin Low Level API

2014-05-22 Thread Tony Rietwyk
Hi Etienne, 

 

The 4.8.5 doco for QObject.qobject_cast links to the Plug  Paint example for 
use of qobject_cast with interfaces.   Mind you, it incorrectly shows the 
return type as QWidget.  Hopefully that doco has been rewritten in v5! 

 

Hope that helps, 

 

Tony

 

 

From: interest-bounces+tony=rightsoft.com...@qt-project.org 
[mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf Of 
Etienne Sandré-Chardonnal
Sent: Thursday, 22 May 2014 5:37 PM
To: interest@qt-project.org
Subject: [Interest] Qt Plugin Low Level API

 

Dear all,

I'm reading the doc in order to implement plugins into my Qt 4.8 application.

The manual says that I need first to define the plugin interface as a pure 
virtual class. In the example it does not inherit QObject.

Then it shows an example plugin implementation which inherits from QObject and 
the interface class (multiple inheritance)

Then it says use qobject_cast() to test whether a plugin implement a given 
interface. However, the qobject_cast page clearly says that the target class 
type must inherit QObject.

I dit not try compiling an example yet, but how could this work? Shouldn't the 
interface inherit QObject, and the plugin implementation simply inherit the 
interface class?

Thanks,

Etienne

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Is there any way to find QML object by id?

2014-05-22 Thread Tony Rietwyk

  Thats exactly what I would also do if it would be my component, but
  unfortunately I don't have an access to TextInput { id: input } which
  is inside the ComboBox.
 
 But you are able to assign the ID or is it built-in? I don't get the
problem,
 although I have not used the ComboBox, so maybe that is the reason. All
 (most :-P) QML elements derive from QtObject, so you can assign
 objectName easily to them.

Hi Tomasz, 

For the specific use case, I think the OP is asking for the QML equivalent
of QComboBox.lineEdit().   

In C++, by inspecting the Qt sources, you can often code for a specific
internal private objectName or class type to use with QObject.findChildren,
or in your css, since that QObject information is public anyway.  Needless
to say, this is just a version specific HACK and should be flagged and
commented as such! 

Alexander, do you have another use case in mind?  It might clarify your
requirement.  (I haven't played with QML yet but I thought all QObject info
is exposed to javascript and the components anyway - isn't that how the
linkage is achieved?)

Regards, 

Tony


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Issue with stylesheet and palette()

2014-05-27 Thread Tony Rietwyk
Hi Max, 

 

In our Qt 4.8.6 app we use the Polish event to apply changes after the styles 
are set in our base window class: 

 

bool BaseForm::event(QEvent *event)

{

   bool result = QDialog::event( event );

   if (event-type() == QEvent::Polish)

   {

  addImagesToButtons( this );

   }

   return result;

}

 

Look at the docs for ensurePolished to see when this event occurs. 

 

Hope that helps, 

 

Tony.

 

 

Sent: Wednesday, 28 May 2014 8:34 AM



Hi all,

 

I've stumbled on a potential issue concerning the usage of stylesheets and 
QWidget::palette() (to get colors set by the stylesheet). In a nutshell, 
accessing palette() within the constructor of the object (e.g QWidget) does not 
work.

 

I've described the issue fully here: 
http://qt-project.org/forums/viewthread/43082/#178369

 

Somebody has even provided a nice workaround (using QTimer::singleShot so that 
the code accessing palette() is executed after the object creation is 
completed).

 

I'm OK with the workaround, I'm posting here just to be sure the behaviour is 
normal and not a bug.

If anybody has a better workaround, I'd be glad to read about it :)

 

MaX.

 

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QLabel inconsistent sizing with word wrap

2014-07-17 Thread Tony Rietwyk
Answering my own question: 

Setting a fixed width overcomes the problem, and only the height changes.
Could someone who uses Git submit to the QLabel word wrap property: 

Note:  Setting word wrap true without a fixed width and/or height
may result in inconsistent sizing. 

Tony

 -Original Message-
 From: interest-bounces+tony=rightsoft.com...@qt-project.org
 [mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf
 Of Tony Rietwyk
 Sent: Friday, 18 July 2014 11:59 AM
 To: interest@qt-project.org
 Subject: [Interest] QLabel inconsistent sizing with word wrap
 
 Hi Everybody.
 
 In my Qt 4.8.6 application I cannot understand why this QLabel widget's
sizing
 varies wildly depending on the text content - even for similar text!
 The QLabel has only WordWrap switched on, and Alignment Top/Left.  All of
 the widgets shown have size policy Preferred, except for the top level
with
 the black border that has horizontal and vertical both set to
 MinimumExpanding.  I've checked the source records and both descriptions
 are plain text without any line breaks, etc.
 
 There are lots of hits when googling, but few answers.
 
 Can anyone shed light on this?  Has the text layout code been improved in
v5?
 
 Regards,
 
 Tony

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QLabel inconsistent sizing with word wrap

2014-07-18 Thread Tony Rietwyk
 Am Fri, 18 Jul 2014 11:59:15 +1000
 schrieb Tony Rietwyk t...@rightsoft.com.au:
 
  Hi Everybody.
 
  In my Qt 4.8.6 application I cannot understand why this QLabel
  widget's sizing varies wildly depending on the text content - even for
 similar text!
  The QLabel has only WordWrap switched on, and Alignment Top/Left.  All
  of the widgets shown have size policy Preferred, except for the top
  level with the black border that has horizontal and vertical both set
  to MinimumExpanding.  I've checked the source records and both
  descriptions are plain text without any line breaks, etc.
 
  There are lots of hits when googling, but few answers.
 
  Can anyone shed light on this?  Has the text layout code been improved
  in v5?
 
  Regards,
 
  Tony
 
 hi,
 
 i assume your yellow marked text is the QLabel in question.
 
 as your whole layout (QFrame?) is smaller in the 2nd screenshot, it would
be
 only reasonable for the QLabel inside this layout to resize as well, or
not?
 
 alex

Hi Alex, 

Thanks for your reply.  The outer frame layout resizes according to the
internal sizes, including the highlighted QLabel, as I select different
records from the list on the left.  Most records return the narrower size,
regardless of whether they have 2 or 6 lines of text.  Hard to see why the
sizeHint from the QLabel would be so different for the two records shown.  

Regards, 

Tony


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Custom layouts

2014-08-05 Thread Tony Rietwyk
Hi Igor, 

 

Your problem makes sense.  Hiding and showing widgets triggers a layout
recalculation, and the layout uses setGeometry to position the widgets.   It
sounds unusual to change widget visibility in a setGeometry override.   I
suggest to use a flag to prevent the recursion yourself.  

 

Regards, 

 

Tony

 

 

Sent: Tuesday, 5 August 2014 4:14 PM



Hi.

 

I found that if in setGeometry() method call hide() or show() on widgets
inside layout then this leads to recursion of layout.

 

What do you think on this problem? May be it is good suggestion to Qt
developers to remove this recursion, because of it is sometimes useful to
hide some widgets in layout for this or that reason?!

 

Thank you.

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Threading Question

2014-10-08 Thread Tony Rietwyk
Hi Jason, 

Are you calling QApplication.exec in your main thread?  In not, I don't
think the slots there will be activated.  

Regards, 

Tony

 -Original Message-
 From: interest-bounces+tony=rightsoft.com...@qt-project.org
 [mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf
 Of Jason Kretzer
 Sent: Thursday, 9 October 2014 2:43 PM
 To: interest@qt-project.org
 Subject: [Interest] Threading Question
 
 I am a bit confused on threading.
 
 Lets say I have Thread A - which is where the program is started - has
 main(), etc.
 
 Inside of main() I instantiate a class called BackgroundClass and I move
it to
 another thread (Thread B).
   BackgroundClass::init();
   QThread *thread = new QThread();
   BackgroundClass::instance()-moveToThread(thread);
   thread-start();
 
 Inside of BackgroundClass in the constructor, I start a QTimer that is
 supposed to go off every 5minutes and call the runTasks function when it
 does.
 QTimer* timer = new QTimer(this);
 connect(timer, SIGNAL(timeout()), this, SLOT(runTasks()));
 timer-start(FIVE_MINS);
 
 I put a qDebug in the runTasks function to ensure that it is a different
thread
 than the main thread (Thread A).
 qDebug()  Running tasks... -- Thread ID:  
QThread::currentThreadId();
 //inside runTasks
 
 This always shows a different ID than the main thread.
 
 
 Back in the main thread (Thread A), I instantiate another class AFTER the
 BackgroundClass instantiation.
 
 WorkManager::init();
 
 this is not moved to a separate thread so, I assume it stays in Thread A.
 
 In the constructor of WorkManager, I connect Signals from BackgroundClass
 to Slots in WorkManager like so.
 
 connect(BackgroundTaskManager::instance(), SIGNAL(someSignal()),
 instance(), SLOT(restartWorker()));
 
 When the BackgroundClass finishes a task, it emits the someSignal.
 
 From what I can tell, as soon as the someSignal is emitted, the
 restartWorker slot is called and the rest of the code that is immediately
after
 that does not execute.  For example, above, the runTasks function is
 supposed to run several tasks in a while loop.  To make sure this loop is
 thread safe, so it can be the only thing running those tasks I put a mutex
 around the while loop.  At the end of the runTask function, the someSignal
is
 emitted the result is set, and then it is returned.
 
 if (!mutex.tryLock()) {
 qDebug()  Previous instance of RunTasks still running...;
 return;
 }
 while(moreTasks) {
   bool result = runTask(t);
 
   updateDatabase(t, result);
 }
 mutex.unlock();
 
 
 Unforturnately, the runTask method never returns, it appears that the
 restartWorker is called immediately upon someSignal being emitted.
 
 So, I say all that to ask, why does the rest of the code not execute?
 Obviously, I am doing something wrong, but I am not sure where the flaw
is.
 Would anyone be so kind as to point me in the right direction?
 
 Thanks!
 
 -Jason
 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Crash in QSerialPort when closing?

2014-10-29 Thread Tony Rietwyk
Hi Sean, 

 

Closing a device within a read slot sounds dodgy anyway.  In these cases, I
usually do QTimer::singleShot(0, ...) and do the close in that slot.  

 

Regards, 

 

Tony

 

 

From: interest-bounces+tony=rightsoft.com...@qt-project.org
[mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf Of
Murphy, Sean
Sent: Thursday, 30 October 2014 5:36 AM
To: interest@qt-project.org
Subject: [Interest] Crash in QSerialPort when closing?

 

I'm getting a weird issue where I can repeatedly cause a crash to happen in
QSerialPort if I attempt to close the serial port when I'm in a slot
connected to the readyRead() signal, and I'm just wondering if I'm doing
something weird.

 

I've got a class that inherits from QSerialPort.  I instantiate this object
in the UI thread but immediately move it to a separate thread.  This object
has a slot, disconnectFromDevice(), that sends a reset command to the serial
device.

 

So the way I intended the software to work is the user clicks the disconnect
button in the UI thread, which sends a signal to the serial port object.
That object sends the reset command to the serial device and the serial
device responds with an acknowledge response.  The acknowledge response
triggers the QSerialPort::readyRead() signal, which triggers my readyRead()
slot.  I parse the acknowledge, then emit a signal back to the UI thread
letting the UI know that the disconnect was successful, and then call
QSerialPort::close() in the serial port object (still inside of my
readyRead() slot).  

 

When I execute setup in a debug build, at this point the application crashes
with a SIGSEV.  For some reason it kicks me into the disassembler instead of
breaking in my code.  If I comment out the close() call, the segfault
doesn't happen. 

 

Below is what's shown in the call stack, but since none of my code is shown
in the call stack, I don't know if I'm crashing on the close() call itself,
or if I crash sometime later because I'm doing something when the port isn't
open.  If I set a breakpoint anywhere in my readyRead() slot the crash
DOESN'T occur.  I only know that removing the close() call removes the
crash.

 

Any ideas?  Specifically, why am I not seeing any of my calls in the call
stack?

Sean

 

0  ReadOverlappedCompletionNotifier::processCompletionRoutine
qserialport_win.cpp   188 0x6704e8ed

1  AbstractOverlappedEventNotifier::event
qserialport_win.cpp   119 0x6704e6d2

2  QApplicationPrivate::notify_helper qapplication.cpp
3467   0xa9ede0f   

3  QApplication::notify   qapplication.cpp
2888   0xa9eb72b  

4  QCoreApplication::notifyInternal
qcoreapplication.cpp  878 0x6b91b572

5  QCoreApplication::sendEventqcoreapplication.h
232 0x6b9bee2b   

6  QEventDispatcherWin32Private::activateEventNotifier
qeventdispatcher_win.cpp 335 0x6b9646e8

7  QEventDispatcherWin32::processEvents
qeventdispatcher_win.cpp 759 0x6b965de7

8  QEventLoop::processEvents   qeventloop.cpp
136 0x6b919650

9  QEventLoop::exec   qeventloop.cpp212
0x6b9198eb

10   QThread::exec  qthread.cpp   509 0x6b794f85


11   QThread::run qthread.cpp   576 0x6b7950ed


12   QThreadPrivate::startqthread_win.cpp 347
0x6b797ac2 

13   msvcrt!_itow_sC:\windows\syswow64\msvcrt.dll
0x775d1287

14   msvcrt!_endthreadex   C:\windows\syswow64\msvcrt.dll
0x775d1328

15   KERNEL32!BaseCleanupAppcompatCacheSupport
C:\windows\syswow64\kernel32.dll   0x7594338a


16   ??   0x16d0ffd4


17   ntdll!RtlpNtSetValueKey
C:\windows\system32\ntdll.dll 0x77c19f72  

18   ??   0x166b7660

19   ntdll!RtlpNtSetValueKey
C:\windows\system32\ntdll.dll 0x77c19f45  

20   msvcrt!_endthreadex   C:\windows\syswow64\msvcrt.dll
0x775d12e5

21   ??   

 



___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Crash in QSerialPort when closing?

2014-10-30 Thread Tony Rietwyk
Seam wrote:

 Sent: Friday, 31 October 2014 12:43 AM
 
  Closing a device within a read slot sounds dodgy anyway.  In these
  cases, I usually do QTimer::singleShot(0, ...) and do the close in that
slot.
 
 I thought about doing the single shot as well.
 
 Is there a more concrete reason (other than it sounding dodgy) that you
 feel like the way I'm currently doing it is not a good idea?
 
 In my use case, I've already sent the I would like to disconnect command
to
 the external device, and I'm waiting for a short acknowledge response.  In
 my readyRead() slot, I validate that response, which means that the
external
 device is in an idle state, listening, so I'm not expecting to receive any
more
 bytes.  So at this point, I'm ready to close the connection.
 
 Sean

I don't have anything more concrete than the example you've already pointed
out!  Qt coders have to do special things to handle these cases around the
emit call - which was presumably not done correctly in the original version
of serial port.  A device often has associated buffers, state flags and
other resources that are released or modified when you close the device.
Doing that in the middle of a read event assumes that the event has
completely finished with the resources and state flags.  

I suppose a different way of thinking about it is to look at the code in a
procedural context:  You would normally open the device, loop reading until
an end condition, then close the device.  It would be weird for the read or
set-end-condition routines to close the device as well - since you may want
to reset the device and read again in a separate loop, without having to
reopening it.  

Regards, 

Tony


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] how to debug a Qt Designer plugin

2014-12-10 Thread Tony Rietwyk
Hi Graham, 

 

It could be several things:

 

- the plugin has been compiled with debug - it must be release build. 

- supporting DLLs are not available in your path. 

- the code in the plugin is relying on initialisation that only occurs in
your main exe. 

 

Because of the first point, you can't run Designer and debug the plugin. 

 

Also note that a single plugin can contain all of your widgets, you don't
need a separate plugin for each.  See
QDesignerCustomWidgetCollectionInterface. 

 

Hope that helps, 

 

Tony

 

 

From: interest-bounces+tony=rightsoft.com...@qt-project.org
[mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf Of
Graham Labdon
Sent: Thursday, 11 December 2014 3:28 AM
To: Interest@qt-project.org
Subject: [Interest] how to debug a Qt Designer plugin

 

Hi

I have developed some designer plugins that are working nicely.

Now I have created another but cannot get it to work.

Within designer I see the following when I do Help-about Plugins -

 

Failed Plugins

C:\Qt\Qt5.3.0\5.3\msvc2012_opengl\plugins\designer\QtDesignerWidgets.dll

Cannot load library
C:\Qt\Qt5.3.0\5.3\msvc2012_opengl\plugins\designer\QtDesignerWidgets.dll The
specified module could not be found

 

Can anyone give me some idea as to how to debug this

 

thanks

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Revert the selection in a QTreeView

2015-01-13 Thread Tony Rietwyk
Glenn wrote:

 Sent: Wednesday, 14 January 2015 8:45 AM
 
 Hi,
 
 In a QTreeView how can I revert the selection?
 
 The behaviour I want is that when the user selects an item, then based on
 some other state, it will either accept the selection or message the user
and
 revert to the previous selection.
 
 The currentChanged method gives me the QModelIndex of the previous
 selection so I can use treeview.setCurrentIndex to set it to the previous
 index, but this causes recursion.
 
 I guess I could use a flag to prevent the recursion, but I'm wondering if
there
 is a better way to get the same behaviour.

Hi Glenn, 

Don't worry - you'll probably end up with several of these 'prevent
recursion' flags for your slots!  

Note:  in Qt 4 there is a bug where calling setCurrentItem in the
currentIitemChanged slot after a mouse click may cause all of the items in
between to be selected - at least in does in QListView!  The solution was to
save the previous item, and use QTimer.singleShot( 0, ... ) to a slot that
does setCurrentItem on the saved value. 

Unfortunately, the Qt API doesn't have an interface that allows you to trap
the change in selection regardless of the cause.  I have recently tried
overriding keyboardSearch, moveCursor and mousePressEvent to force the
validation before the selection is changed.  

A similar problem occurs when you need to validate a page in a tab widget
before the tab changes. 

Good Luck! 



___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QtSql database insertion issues...

2015-04-21 Thread Tony Rietwyk
Hi Ben, 

 

Does the prepare work? 

 

I assume the database must be open, or you would get a different message. 

 

Hope that helps, 

 

Tony

 

 

From: interest-bounces+tony=rightsoft.com...@qt-project.org 
[mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf Of BRM
Sent: Wednesday, 22 April 2015 12:42 PM
To: Qt Project
Subject: [Interest] QtSql database insertion issues...

 

I've been out of the Qt loop for a little bit; but I'm working to bring myself 
back up to speed.

I'm presently working on a small project that is basically a GUI equivalent of 
md5sum/sha1sum where I'm attempting to store the data in a SQLite Database 
during run-time. I've already done a command-line version using python, and I'm 
pulling the SQL statements from there. However, I am having trouble with the 
QSqlQuery prepared statements. The entire code chunk is here:

 
https://github.com/BenjamenMeyer/qtmd5gui/blob/branch_qt4_base/src/hash_db.cpp
 


https://github.com/BenjamenMeyer/qtmd5gui/blob/branch_qt4_base/src/hash_db.cpp

 

I'm building the project on Kubuntu 14.10, using the Qt4.8 libraries provided 
by the distro.

 

To summarize the code, I'm doing the following:

 

QSqlQuery insertion(myDb);

insertion.prepare(INSERT INTO master_directory (hash, path) VALUES(:hash, 
:path));

insertion.bindValue(:hash, some hash);

insertion.bindValue(:path, /some/path);

if (!insertion.exec()) qDebug()  insertion failed. Log errors and value 
bindings;

 

I've added debug output that shows the values being bound; however, it 
continues to complain about a parameter mismatch.

 

You can see the output here:

https://gist.github.com/BenjamenMeyer/dffe01b702dc8f507c17

 

I've tried binding both by name (preferred) and by order. (I have a C 
Preprocessor Define to control it); but neither are working.

 

This is my first time really playing with a database via Qt.

What am I doing wrong?

 

TIA,

 

Ben

 

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Windows VST plugin based on Qt

2015-05-19 Thread Tony Rietwyk
Hi Nuno, 

I strongly suggest to download Dependency Walker utility, and use that to 
test loading your DLL on Windows.  

Also, there are dozens of VST examples available, maybe you start with one that 
works, then extend it with Qt or whatever. 

Regards, 

Tony

 Sent: Tuesday, 19 May 2015 4:27 PM
 
 Hi,
 
 I�m trying to build a VST plugin based on Qt.
 
 A VST plugin is a framework for creating audio processing and instrument
 plugins. It provides an api that one should follows. The result is a dynamic
 library that will be loaded by the host (dll on windows case, bundle on mac
 case). I have done it successfully on Mac (with still a lot of tests to 
 perform
 and the need for correct deploy) and now i�m trying on Windows.
 
 On Windows i�m being faced with some dll loading problems.
 
 If I build the plugin without link Qt at all (CONFIG -= qt), the plugin is
 recognized by the host. Otherwise it isn�t. I want to use Qt, specially QML 
 for
 UI. There are simpler ways of doing this, but I love Qt and I want my code to
 be the most transversal as possible.
 
 I have been suggested that this problems is due to the loading path of the
 libraries. I suggested solution relies in using /DELAYLOAD
 
 I have tried to perform /DELAYLOAD:Qt5Core.dll and the other three libs
 started by icu, and then using the SetDllDirectory to the path I have the
 deployed plugin.
 
 Still, the host is unable to load the plugin correctly.
 
 Can someone give me an insight on how to do this on windows?
 
 Thanks,
 
 Regards,
 
 Nuno


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Using QWebSocketServer in a thread other than the GUI thread?

2015-05-27 Thread Tony Rietwyk
Rainer wrote: 

 I would like to add a QWebSocketServer to an existing application. I would
 like to have all its operation handled by a thread different from the GUI
 thread to get communication separated from the GUI part.

If you create the QWebSocketServer in the thread's run override, does that fix 
your issue with QNativeSocketEngine? 

Regards, 

Tony


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QThread sleep on QMutex

2015-07-30 Thread Tony Rietwyk
Igor wrote: 

 Because in Qt 4 QThread::sleep is protected.

You can unprotect it by deriving your own class from QThread and making
whichever static methods public!  As long as you are aware of the pitfalls
(don't sleep in main thread, etc.), and much easier than messing with locks
just to gain access to sleep. 

Regards, 

Tony

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Need argumentative help..... giving qobject copy/assignment constructor and put it in qlist/qmap

2015-07-20 Thread Tony Rietwyk
Hi Guido, 

 

Did they patch QObject itself, or just add these routines to a descendent - 
I'll assume the latter.  The added routines can't be calling the QObject 
ancestor routines, since that wouldn't compile.  So what are the routines 
doing?  Just copying over their own member vars?  We'll need to see some code 
to decide how bad it is. 

 

Regards, 

 

Tony

 

 

From: interest-bounces+tony=rightsoft.com...@qt-project.org 
[mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf Of 
Guido Seifert
Sent: Monday, 20 July 2015 10:51 PM
To: interest@qt-project.org
Subject: [Interest] Need argumentative help. giving qobject copy/assignment 
constructor and put it in qlist/qmap

 

Hi, just seen this in project's code. Worse, I have been told to do it exactly 
this way in another code part. I must say I am less than thrilled. On first 
glance this code seems to work. There is not much copying around. The objects 
sit happily in their containers. But it smells. So what is the worst what can 
be expected? Something not obvious? On different compilers? I need some 
convincing reasons, which cannot just waved away. or confirmation that 
eveything is fine and I can stop worrying but this also must be convincing. 
Perhaps even more ;-)
-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QLineEdit and QTableWidget

2015-07-07 Thread Tony Rietwyk
Hi allen, 

 what i really want is to be able to
 attach multiple persons rather a single one with each item in the (say,
 household) widget. so i thought to use a single column table widget and
 follow the spreadsheet example to create the table, delegate and item
 widgets putting the above line edit each item widget.

I'm confused by your last line.  Do you want separate line edits to appear
on each row (create each and use view.setItemWidget), or just the current
row (delegate should be doing this already?), or hovering over the previous
to current row? 

But the start of your requirement sounds more like a combo box that
automatically adds items.  So instead of the delegate creating an edit box
on the current string item, it creates a combo box instead and the item's
value is a string list of people? 

Hope that helps, 

Tony


 -Original Message-
 From: interest-bounces+tony=rightsoft.com...@qt-project.org
 [mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf
 Of Rene Decartes
 Sent: Tuesday, 7 July 2015 12:41 PM
 To: interest@qt-project.org
 Subject: [Interest] QLineEdit and QTableWidget
 
 hello,
 
 i rather green at using qt. jumping right in, i had a qlineedit on a
widget that is
 basically coded as:
 
 People::createPersonEdit()
 {
 personEdit = new QLineEdit ;
 personLabel = new QLabel( tr( Person: ) ) ;
 personLabel-setBuddy( personEdit ) ;
 
 personModel = new QSqlQueryModel( this ) ;
 personModel-setQuery( SELECT number , name FROM someTable
 WHERE number  -1 ORDER BY name ) ;
 
 personCompleter = new QCompleter( this ) ;
 personCompleter-setModel( personModel ) ;
 
 personView = new QTableView ;
 personCompleter-setPopup( personView ) ;
 
 int width = personView-columnWidth( 0  ) ;
 width += personView-columnWidth( 1  ) ;
 
 personView-setColumnHidden( 0 , true ) ;
 personView-setColumnWidth( 1 , width ) ;
 
 personEdit-setCompleter( personCompleter ) ;
 
 connect( personEdit , SIGNAL( editingFinished() ) ,
  this , SLOT( personValidate() ) ) ; } what i really want is
to be able to
 attach multiple persons rather a single one with each item in the (say,
 household) widget. so i thought to use a single column table widget and
 follow the spreadsheet example to create the table, delegate and item
 widgets putting the above line edit each item widget.
 
 but it is turning out to be convoluted (for me!) am i approaching this
correctly?
 
 --
 allen
 
 There are 10 kinds of people. Those who do understand binary code, and
 those who do not.
 ___
 Interest mailing list
 Interest@qt-project.org
 http://lists.qt-project.org/mailman/listinfo/interest

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] How to use QStyle.sizeFromContents with QStyleOptionFrame?

2015-09-09 Thread Tony Rietwyk
Hi Everybody, 

Using Qt 5.5.0 from installed binaries, in my QFrame based custom widget
sizeHint override I want to have: 

QSize contentSize = ;

QStyleOptionFrame optFrame;
initStyleOption();
QSize styleSize = style()->sizeFromContents( QStyle::CT_Frame,
optFrame, contentSize, this );

But of course, CT_Frame doesn't exist!  So how can I make this work?  A
global style sheet is used to produce different frame borders, padding,
background colors, etc.  

Thanks in advance, 

Tony.


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] [qt-4.8 windows] Setting QTreeView selected item style in qss

2015-12-29 Thread Tony Rietwyk
Hi Ruan, 

 

In our global style sheet we use: 

 

QTreeView {

background-color: transparent;

selection-background-color: green; /* Used on Mac */

selection-color: white; /* Used on Mac */

show-decoration-selected: 1;

}

QTreeView::item {

background-color: transparent;

}

QTreeView::item:selected {

background-color: green; /* Used on Windows */

color: white;

}

QTreeView::item:disabled:selected {

background-color: #e0e0e0;

color: black;

}

 

Hope that helps! 

 

Tony

 

 

From: Interest [mailto:interest-boun...@qt-project.org] On Behalf Of Ruan leitão
Sent: Wednesday, 30 December 2015 2:31 AM
To: interest@qt-project.org
Subject: [Interest] [qt-4.8 windows] Setting QTreeView selected item style in 
qss

 

Hello, 

I already have post this question in Stack Overflow 

 , but a have no answer. Now a friend tell me to talk on the mailing list.

 

I need to change the background color of the selected item on a QTreeView. I 
already tried using the Qt examples and other SO questions.

The style applied to the ::branch subcontrol works fine, but none of the 
commands in the ::item subcontrols works.

Here my current result:

  Image removed by sender. enter image 
description here

But I want a result like this:

  Image removed by sender. enter image 
description here

Can someone help me, thanks in advance.

Ruan L. Nunes

-- 

Ruan L. Nunes

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] Adding editable files to VS2013 project via .pro and qmake

2016-05-26 Thread Tony Rietwyk
Hi Everybody, 

I am using Qt5.5.1 and qmake to generate a project for Visual Studio 2013.
I would like to add some text files to those shown in the Solution Explorer
so that I can edit them.  They are not required for building, nor for
deployment.  

I tried adding a file in VS, and then diff'ing to the generated version.
Only one extra tag is included in the project file:  

  

  

I can manually insert this section into the .vcxproj file after I run qmake.
Browsing the Qt sources, I can see this tag can be written in
msbuild_objectmodel.cpp on line 2039.  But I can't trace back through
callers to see how to execute that statement.  

Is there a syntax for my .pro to include these additional files?  

Thanks in advance! 

Tony


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Native event filter in QtService

2016-06-24 Thread Tony Rietwyk
Doh!  I looked but missed that paragraph.  Sorry for the noise! 

 

Tony

 

 

From: Interest
[mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf Of
Julius Bullinger
Sent: Friday, 24 June 2016 7:03 PM
To: interest@qt-project.org
Subject: Re: [Interest] Native event filter in QtService

 

Hi Tony,

 

thanks for your reply. Reading the documentation of
QAbstractEventDispatcher::installNativeEventFilter(), it says in the fourth
paragraph

 

If multiple event filters are installed, the filter that was
installed last is activated first.

 

Thus, I was under the impression that I should be able to add my own filter,
without overwriting the one installed by QtService. Is this incorrect?

 

Regards,

Julius

 

Von: Interest
[mailto:interest-bounces+julius.bullinger=asctec...@qt-project.org] Im
Auftrag von Tony Rietwyk
Gesendet: Freitag, 24. Juni 2016 10:57 Uhr
An: interest@qt-project.org
Betreff: Re: [Interest] Native event filter in QtService

 

Hi Julius, 

 

qtservice_win.cpp around line 830 at your reference [1] installs its own
nativeEventFilter - probably displacing yours.  

 

I suspect you'll need to merge the Qt filter into yours, and get rid of that
install.  

 

Regards, 

 

Tony

 

 

From: Interest
[mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf Of
Julius Bullinger
Sent: Friday, 24 June 2016 5:25 PM
To: interest@qt-project.org Interest
Subject: [Interest] Native event filter in QtService

 

I'm trying to write a small (windows only) service based on QtService [1]
listening for some USB device events. For this, I created a
NativeDeviceEventFilter class based on QAbstractNativeEventFilter. It works
perfectly when used in a QCoreApplication.

 

Now, when installing this event filter in my UpdaterService class, it isn't
being called.

 

I tried each of:

 

  application()->installNativeEventFilter(deviceEvent_);
 
  QCoreApplication::instance()->installNativeEventFilter(deviceEvent_);
 
 
QAbstractEventDispatcher::instance()->installNativeEventFilter(deviceEvent_)
;

 

both in the service's constructor and start() method, as well as using a
local instance of NativeDeviceEventFilter,

but none of these worked. The event just isn't registered at all.

 

Has anyone ever done something like this? Or is there another way to receive
native messages (MSG structs) in a QtService?

 

Best regards,

Julius

 

[1]: https://github.com/qtproject/qt-solutions/tree/master/qtservice

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Native event filter in QtService

2016-06-24 Thread Tony Rietwyk
Hi Julius, 

 

qtservice_win.cpp around line 830 at your reference [1] installs its own
nativeEventFilter - probably displacing yours.  

 

I suspect you'll need to merge the Qt filter into yours, and get rid of that
install.  

 

Regards, 

 

Tony

 

 

From: Interest
[mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf Of
Julius Bullinger
Sent: Friday, 24 June 2016 5:25 PM
To: interest@qt-project.org Interest
Subject: [Interest] Native event filter in QtService

 

I'm trying to write a small (windows only) service based on QtService [1]
listening for some USB device events. For this, I created a
NativeDeviceEventFilter class based on QAbstractNativeEventFilter. It works
perfectly when used in a QCoreApplication.

 

Now, when installing this event filter in my UpdaterService class, it isn't
being called.

 

I tried each of:

 

  application()->installNativeEventFilter(deviceEvent_);
 
  QCoreApplication::instance()->installNativeEventFilter(deviceEvent_);
 
 
QAbstractEventDispatcher::instance()->installNativeEventFilter(deviceEvent_)
;

 

both in the service's constructor and start() method, as well as using a
local instance of NativeDeviceEventFilter,

but none of these worked. The event just isn't registered at all.

 

Has anyone ever done something like this? Or is there another way to receive
native messages (MSG structs) in a QtService?

 

Best regards,

Julius

 

[1]: https://github.com/qtproject/qt-solutions/tree/master/qtservice

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Macro support with QTextEdit.

2016-01-10 Thread Tony Rietwyk
Bill asked:

> Sent: Sunday, 10 January 2016 1:25 AM
> Next question:
> 
>  How do I save and restore to HTML?

Hi Bill, 

I can't help with the saving.  But we display html documents with 
tags and replace them with QWidgets: 

- We fetch all of the text using codecForHtml. 
- Search for  tags, parse the arguments and replace the tags with
plain "[[object]]" markers, building up a list of their locations. 
- Set the modified html into a QTextBrowser. 
- Loop over the locations (in reverse order) and create a widget for each
object, parented by the browser, remove the text and insert the
ObjectReplacementCharacter. 

There are lots of painful gotchas to work around - moving the widgets to the
correct location, hiding the widgets until required, rendering with the
correct scale when printing, etc. 

The document object interface is pretty stunted - in Qt4 I don't believe
there was a virtual hook into the html saving process to handle the special
characters.  I suspect you'll need to modify the Qt sources, or create a
copy of the document, and do the reverse of the steps above.  

Good luck! 

Tony


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] how to add a buton to the hovered item from a qtreeview

2016-01-28 Thread Tony Rietwyk
> Sent: Friday, 29 January 2016 2:45 PM
> 
> Hi
> I have a `QTreeView`, I control the background colors of items trough a
css.
> When the pointer is over an item his background is greyed.
> 
> I use the signal `entered` to detect which item, aka `QModelIndex`, aka
row,
> is hovered. If I use that signal, is because I have to show a
`QPushButton`
> over a part of the row, the position of the button is at the very right of
the
> row though.
> 
> If no row is hovered, then the button is hidden.
> 
> The click event is related trough the actual hovered row.
> 
> so far so good, all is working but one thing, the background color. When I
> move the pointer over the button, the treeview set the row behind the
> button to "not hovered". I used the paint function in the past, but
because of
> some narrow minded people forcing me to set the background in the css
> stylesheet, I'm facing that issue...
> 
> using the attribute `WA_TransparentForMouseEvents` can't help since I need
> to click on the button.
> 
> so any idea, is welcome.
> 
> I don't know if it can be helpful, but the `QTreeView` is inherited to
> MyTreeView, and this class contains the `QPushButton`
> 
> 
> regards,
> Nicolas

Hi Nicolas, 

I think that you will need to use WA_TransparentForMouseEvents, and then
handle the MouseDown event in MyTreeView to check where along the row the
user has clicked to see if it is within the button.  

Regards, 

Tony


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] qml <--> c++

2016-02-27 Thread Tony Rietwyk
Hi Nicolas, 

 

I can see you left out Q_OBJECT on CustomWebView.  Not idea whether the rest 
will work or not to achieve your aim. 

 

Tony

 

 

From: Interest [mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] 
On Behalf Of jagernico...@legtux.org
Sent: Sunday, 28 February 2016 3:16 PM
To: interest@qt-project.org
Subject: [Interest] qml <--> c++

 

Hi,

in my main.qml I have this code :

WebEngineView {
id: webview
url: "192.168.2.1"
anchors.fill: parent
onNewViewRequested: {
var w_ = crecreateObject()
request.openIn(appWin.w_)
}
}

when onNewViewRequested is called, I would like to open the url of the request 
in the the same WebEngineView, not creating a new WebEngine. So I was thinking 
to create some class who inherits of WebEngine.

I didn't found any class called WebEngine I can inherit, or I did not found the 
header... but I found QWebEngine, so I did this :

// in CustomWebView.h
#pragma once
#include 

class CustomWebView : public QWebEngineView
{
Q_PROPERTY(QString author READ author WRITE setAuthor NOTIFY authorChanged)

public:
CustomWebView(QWidget *parent);
CustomWebView();

};

I register the qml inside my main.cpp : 

qmlRegisterType("customWebView", 1, 0, "CustomWebView");

and in my main.qml I did some changes/add :

import CustomWebView 1.0

CustomWebView {
id: webview
url: "192.168.2.1"
anchors.fill: parent
//onNewViewRequested: {
//var w_ = crecreateObject()
//request.openIn(appWin.w_)
//}
}

but, when I compiled, I got the msg : Cannot assign to non-existent property 
"url"

obviously, I didi some mistake, but where ?

Regards,
Nicolas

 

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QApplication.activeWindow().pos() not returning correct value after sacling on OSX

2016-02-17 Thread Tony Rietwyk
Hi Frank - sorry for replying to you directly before! 

 

Have you looked at event filtering?  A derived QObject can monitor, and
supress events going to another QObject - including windows.  So:

 

- when the hot key occurs, you installEventFilter on the current window, 

- if KeyPress Esc, then cancel, 

- if MousePress, then record start pos, 

- if MouseMove, then record the end pos 

- if MouseRelease, then record the end pos and finish

 

When you finish or cancel, removeEventFilter.  While active, you always
suppress the event to stop if going to the target window.  

 

Hope that helps, 

 

Tony

 

 

From: Frank Rueter | OHUfx [mailto:fr...@ohufx.com] 
Sent: Thursday, 18 February 2016 2:21 PM
To: Tony Rietwyk
Cc: interest@qt-project.org
Subject: Re: [Interest] QApplication.activeWindow().pos() not returning
correct value after sacling on OSX

 

Hi Tony,

sorry, let me clarify:
QT's co-oridnate system starts at the top left, right?
So when I scale the window by dragging the left side (or the top), the point
of origin changes and thus I expect a different global position for the
widget.

The reason I am tying to determine the exact geometry of the parent
application is because I am trying to implement something like an invisible
slider, a mode where the use can click+drag anywhere in the host application
to change a certain value. Upon release the mode disables itself until a
hotkey is pressed again.
E.g. if the host application is a video player, I am trying to implement a
mode where the user can hit a hotkey, then click anywhere in the player
to scrub through the video.

I'm sure there are better ways to go about this (and I'd love to hear advise
on this), but at the moment, as a proof of concept, I am creating a
transparent widget that catches the mouse event and emits the required
signal, and I'd like for that widget to perfectly sit on top of the parent
app so if the user click/drags outside of it, it won't have any effect.

Ideally I'd just force the mouse event to my QObject rather than create an
transparent widget, but I don't know if this is possible?

Does that make sense?

Cheers,
frank



On 18/02/16 3:59 pm, Tony Rietwyk wrote:

Hi Frank, 

 

I don't understand what you are asking!  Why do you expect that changing the
window size will change the position?   You say 'resulting in an offset for
my widget' - sounds like you are adding the new pos instead of just using
it?  

 

Tracking foreign native windows is pretty rare.  You need to provide a
cut-down version of what you are doing so others can easily run it.  

 

Regards, 

 

Tony

 

 

From: Interest
[mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] On Behalf Of
Frank Rueter | OHUfx
Sent: Thursday, 18 February 2016 8:14 AM
To: interest@qt-project.org
Subject: Re: [Interest] QApplication.activeWindow().pos() not returning
correct value after sacling on OSX

 

anybody?
is this a bug?

On 16/02/16 12:21 pm, Frank Rueter | OHUfx wrote:

Hi,

I am trying to figure out my host application's window geometry reliably and
am struggling a bit.

I use QApplication.activeWindow().geometry() to drive my custom widget's
geometry (I need to sit exactly on top of the host application).
All works fine and my widget sits exactly on top of the host application
window, until the host app is scaled by dragging one of it's sides out or
in. After that QApplication.activeWindow().geometry() still returns the same
exact position, though the size is correct, resulting in an offset for my
widget.
Turns out scaling windows on OSX by dragging their edges doesn't seem to
update QApplication.activeWindow().pos()

As soon as I grab the title bar and move the host app a tiny bit,
QApplication.activeWindow().pos() seems to be updated correctly.

Is there a fix/workaround for this?

Cheers,
frank

-- 


 <http://www.ohufx.com> ohufxLogo 50x50

vfx compositing <http://ohufx.com/index.php/vfx-compositing>  | workflow
customisation and consulting <http://ohufx.com/index.php/vfx-customising>  







___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

 

-- 


 <http://www.ohufx.com> ohufxLogo 50x50

vfx compositing <http://ohufx.com/index.php/vfx-compositing>  | workflow
customisation and consulting <http://ohufx.com/index.php/vfx-customising>  

 

 

-- 


 <http://www.ohufx.com> ohufxLogo 50x50

vfx compositing <http://ohufx.com/index.php/vfx-compositing>  | workflow
customisation and consulting <http://ohufx.com/index.php/vfx-customising>  

 

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] How to use QStyle::sizeFromContents on a QFrame - missing CT_Frame?

2016-02-18 Thread Tony Rietwyk
Hi Everybody, 

I have a QFrame derived widget that is styled by a global stylesheet that
sets padding, border width, etc.  When I know the size of the contents, what
do I pass as ContentsType to get the adjusted size to use as
minimumSizeHint?  

Using style()->sizeFromContents( CT_ToolButton, nullptr, contentsSize, this
) almost works, but it returns values that are several pixels too big.  

Regards, 

Tony

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] Qt 5.6.0 problems

2016-03-19 Thread Tony Rietwyk
Hi Everybody, 

Using qt-enterprise-windows-x86-msvc2013-5.6.0.exe package coming from
5.5.1: 

1) The qmake rule:

win32 {
# These aren't available in some Windows versions so delay loading
them until we can check they are available
LIBS += /DELAYLOAD:mfplat.dll
LIBS += /DELAYLOAD:mfreadwrite.dll
}

in the resulting VS 2013 project now gets a linker error  "cannot open input
file '\DELAYLOAD:mfplat.dll'"  so it seems qmake is replacing the slash with
backslash.  Is there a way that I can prevent that happening? 


2) A new header file gives warnings in VS 2013 for EACH file that is
compiled: 

1>C:\qt\Qt5.6.0\5.6\msvc2013\include\QtGui/qrgba64.h(100): warning C4242:
'argument' : conversion from 'uint' to 'quint8', possible loss of data
(..\..\src\application\i18n_system.cpp)
1>C:\qt\Qt5.6.0\5.6\msvc2013\include\QtGui/qrgba64.h(121): warning C4242:
'return' : conversion from 'uint' to 'quint8', possible loss of data
(..\..\src\application\i18n_system.cpp)
1>C:\qt\Qt5.6.0\5.6\msvc2013\include\QtGui/qrgba64.h(122): warning C4242:
'return' : conversion from 'uint' to 'quint8', possible loss of data
(..\..\src\application\i18n_system.cpp)
1>C:\qt\Qt5.6.0\5.6\msvc2013\include\QtGui/qrgba64.h(123): warning C4242:
'return' : conversion from 'uint' to 'quint8', possible loss of data
(..\..\src\application\i18n_system.cpp)
1>C:\qt\Qt5.6.0\5.6\msvc2013\include\QtGui/qrgba64.h(124): warning C4242:
'return' : conversion from 'uint' to 'quint8', possible loss of data
(..\..\src\application\i18n_system.cpp)
1>C:\qt\Qt5.6.0\5.6\msvc2013\include\QtGui/qrgba64.h(137): warning C4242:
'initializing' : conversion from 'uint' to 'const quint16', possible loss of
data (..\..\src\application\i18n_system.cpp)
1>C:\qt\Qt5.6.0\5.6\msvc2013\include\QtGui/qrgba64.h(138): warning C4242:
'initializing' : conversion from 'uint' to 'const quint16', possible loss of
data (..\..\src\application\i18n_system.cpp)
1>C:\qt\Qt5.6.0\5.6\msvc2013\include\QtGui/qrgba64.h(139): warning C4242:
'initializing' : conversion from 'uint' to 'const quint16', possible loss of
data (..\..\src\application\i18n_system.cpp)
1>C:\qt\Qt5.6.0\5.6\msvc2013\include\QtGui/qrgba64.h(140): warning C4242:
'argument' : conversion from 'const quint32' to 'quint16', possible loss of
data (..\..\src\application\i18n_system.cpp)
1>C:\qt\Qt5.6.0\5.6\msvc2013\include\QtGui/qrgba64.h(177): warning C4242:
'argument' : conversion from 'const quint32' to 'quint16', possible loss of
data (..\..\src\application\i18n_system.cpp)

This makes finding compilation errors painful.  Would modifying the header
to add some static_casts cause problems in our binaries not matching the
pre-built DLLs?  

3) Some of the Qt sources do not match when debugging and stepping into
those routines.  Should I raise a bug for these?  Is this possibly due to
inconsistent line endings?  Are they cleaned for each target as part of the
package build process?  

Regards, 

Tony


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Regarding QtreeWidget

2016-03-04 Thread Tony Rietwyk
Hi Roshni, 

 

It depends on the number of columns, and whether the data is static or dynamic. 
 Even then 500 nodes doesn't sound much, so I would just use QTreeWidget for 
now.  

 

Hope that helps, 

 

Tony

 

 

From: Interest [mailto:interest-bounces+tony=rightsoft.com...@qt-project.org] 
On Behalf Of Roshni Lalwani
Sent: Friday, 4 March 2016 7:06 PM
To: interest@qt-project.org
Subject: [Interest] Regarding QtreeWidget

 

I have application in which I am planning to use a QtreeWidget . The maxinum 
number of elements in the treeWidget can go uptp 500 . COuld you let me how 
will be performance of using QtreeWidget for 500 elements . Will it lead to 
some performance degradation

 

Regards

Roshni

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Howto keep a pushButton style while changing the backgroundcolor

2016-04-25 Thread Tony Rietwyk
Anton said: 

> Sent: Tuesday, 26 April 2016 2:53 AM
> Hi,
> 
> I am experimenting with qt 5.6.0.
> 
> 1. I create a QtWidgts application.
> 2. I drop a pushButton in the Main Window 3. I change the styleSheet of
the
> QMainWindow
>to: background-color: rgb(85, 170, 255);
> 
> Now the button has the same background color too.
> 
> How can I leave the style of the pushbutton as it is?
> (without inheriting the blue background color from the QMainWindow)
> 
> I didn't find any solution and I do not want to set a background bitmap
for
> such a simple problem.
> 
> What point did I miss?
> 
> Thanks for a hint.
> 
> Anton

You missed some CSS.  Without a CSS selector, the background-color
recursively applies to all widgets parented by the main window. 

Try setStyleSheet( "QMainWindow { background-color: rgb(85, 170, 255); }" );
or
  setStyleSheet( "#mainWindowObjectName { background-color: rgb(85, 170,
255); }" ); 

Hope that helps, 

Tony


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Running Qt app in a browser

2016-04-25 Thread Tony Rietwyk
K. Frank said: 

> Hi Larry!
> 
> On Mon, Apr 25, 2016 at 4:59 PM, Larry Martell 
> wrote:
> > Is it possible to run a Qt app in a browser? I have googled for this,
> > and found some hits, but none seen like they ever worked out. The most
> > promising seems to be http://wiki.qt.io/Qt_for_Google_Native_Client
> > but the readme link is broken, so that's discouraging. Anyone have any
> > pointers on if this can be done and if so how?
> 
> This doesn't answer your question, but as an aside, there is a
web-application
> framework called Wt:
> 
>https://www.webtoolkit.eu/wt
> 
> Wt shares some of the Qt philosophy -- application code (and the Wt
library)
> is written in C++, it is widget-based, and it uses signals and slots.  I
don't know
> Wt's history, but I think Qt that significantly influenced the design of
Wt.
> 
> Of course, high-level similarities notwithstanding, the details are
entirely
> different.  You couldn't, for example, compile a Qt application into a Wt
> application.
> 
> But if you like Qt and were starting a new web-application development
> project, Wt could make sense, and if you really needed to port a Qt
> application to the web, porting from Qt to Wt would still be a substantive
> port, but the similar philosophy might make the port a little smoother.
> 
> > Thanks!
> 
> Good luck!
> 
> K. Frank

I am currently creating a Wt based web application that reuses many of our
non-GUI Qt based classes.  I works really well based on the prototypes done
so far.  

Theoretically, you could create a QPaintEngine that uses the WPainter
interface to draw GUI objects, but I haven't investigated that. 

Tony


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] lupdate -compress makes files BIGGER?

2016-07-20 Thread Tony Rietwyk
Hi Jason, 

If your files are already compressed - eg, jpeg images, then trying to
compress them again can result in being slightly larger, due to extra
prefixes, etc.  In your files, it seems to be about 550 bytes, which does
seem a bit large. 

Regards, 

Tony



> -Original Message-
> From: Interest [mailto:interest-bounces+tony=rightsoft.com.au@qt-
> project.org] On Behalf Of Jason H
> Sent: Thursday, 21 July 2016 5:10 AM
> To: interestqt-project.org
> Subject: [Interest] lupdate -compress makes files BIGGER?
> 
> $ lupdate -compress app.pro
> $ ls -l -S *.qm
> -rw-r--r--  1 jhihn  staff  11570 Jul 20 15:02 app_mr.qm
> -rw-r--r--  1 jhihn  staff  11102 Jul 20 15:02 app_es.qm
> -rw-r--r--  1 jhihn  staff  10975 Jul 20 15:02 app_tl.qm
> -rw-r--r--  1 jhihn  staff  10556 Jul 20 15:02 app_ta.qm
> -rw-r--r--  1 jhihn  staff  10528 Jul 20 15:02 app_en.qm
> -rw-r--r--  1 jhihn  staff  10313 Jul 20 15:02 app_ar.qm
> -rw-r--r--  1 jhihn  staff  10164 Jul 20 15:02 app_te.qm
> -rw-r--r--  1 jhihn  staff  10018 Jul 20 15:02 app_km.qm
> -rw-r--r--  1 jhihn  staff   9824 Jul 20 15:02 app_kn.qm
> -rw-r--r--  1 jhihn  staff   9691 Jul 20 15:02 app_vi.qm
> -rw-r--r--  1 jhihn  staff   9406 Jul 20 15:02 app_hi.qm
> -rw-r--r--  1 jhihn  staff   7335 Jul 20 15:02 app_zh.qm
> 
> $ lupdate app.pro
> $ ls -l -S *.qm
> -rw-r--r--  1 jhihn  staff  11017 Jul 20 15:08 app_mr.qm
> -rw-r--r--  1 jhihn  staff  10613 Jul 20 15:08 app_es.qm
> -rw-r--r--  1 jhihn  staff  10486 Jul 20 15:08 app_tl.qm
> -rw-r--r--  1 jhihn  staff  10091 Jul 20 15:08 app_ta.qm
> -rw-r--r--  1 jhihn  staff  10039 Jul 20 15:08 app_en.qm
> -rw-r--r--  1 jhihn  staff   9848 Jul 20 15:08 app_ar.qm
> -rw-r--r--  1 jhihn  staff   9699 Jul 20 15:08 app_te.qm
> -rw-r--r--  1 jhihn  staff   9553 Jul 20 15:08 app_km.qm
> -rw-r--r--  1 jhihn  staff   9359 Jul 20 15:08 app_kn.qm
> -rw-r--r--  1 jhihn  staff   9202 Jul 20 15:08 app_vi.qm
> -rw-r--r--  1 jhihn  staff   8941 Jul 20 15:08 app_hi.qm
> -rw-r--r--  1 jhihn  staff   6846 Jul 20 15:08 app_zh.qm
> ___
> Interest mailing list
> Interest@qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


  1   2   >