[Interest] QSyntaxHighlighter change QTextBlockFormat

2022-01-04 Thread Joshua Grauman

Hi all,

I have been researching how to have a QSyntaxHighlighter change 
QTextBlockFormat. I need my syntax highlighter to change the indent, left 
and right margins, line height, etc. of a QTextDocument/QTextEdit.


I was able to have my class derived from QSyntaxHighlighter change the 
QTextBlockFormat of individual blocks easy enough using the QTextCursor 
interface, but the problem with that is that it messes up undo/redo 
functionality. All of the block format changes go onto the undo/redo stack 
and so make undo/redo unusable.


I have tried to find a way to modify QTextBlockFormat directly (getting 
the QTextLayout * of the current block and trying setPosition() on it, or 
even trying to move the individual lines of the QTextLayout), but it can't 
modify it here as I suspected (at least the way I tried it).


I can't find any other way to modify QTextBlockFormat in a way that won't 
be recorded onto the undo/redo stack.


So my options are (that I can see):

1) Roll my own complete undo/redo stack for QTextDocument/QTextEdit. This
   seems overkill since it's already written.

2) Modify Qt to be able to disable the undo/redo stack temporarily while
   the QSyntaxHighlighter is changing the block format. There's already a
   function QTextDocument::setUndoRedoEnabled(bool enable). But I can't
   use it directly because it clears the undo/redo stack (the docs says
   the undo stack, but the code looks like it's clearing the redo
   stack???). Either way I need to modify
   QTextDocument::setUndoRedoEnabled(bool enable) so that it can enable
   and disable undo/redo without clearing the stack(s). It would seem like
   I could add a second parameter to the function with a default value to
   work like it does currently, but with an option that can be added to
   not clear the stack. Although I've only written 2-3 patches for Qt,
   this seems easy enough that I could do it. But I wanted to check first
   if this seems like a reasonable approach and would be likely to be
   accepted.

Obviously, I would like to take option 2, but I wanted feedback first. 
Does that seem like a reasonable approach? Will it be likely to be 
included in Qt? I don't want to write a patch if there are clear problems 
with the approach. Also, if anyone has a way to easily modify the 
blockformat of a block without affecting undo/redo, that would be great. 
Or even if someone has rolled their own undo/redo for QTextDocument, I 
suppose I could use that. Thanks for any help, it is greatly appreciated.


Josh
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


[Interest] QTextLayout::setPreeditArea()

2022-01-03 Thread Joshua Grauman

Hi all,

I am working on using QTextLayout and I was wondering if someone could 
give me a quick explanation for what preedit text / preedit area was in 
this context? There's not much detail in the docs, reading the Qt code and 
googling hasn't helped me much.


When/why would you use setPreeditArea(int pos, QString text) vs 
setText(QString). What's a preedit area?


Thanks in advance,

Josh
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


[Interest] qSort replacement

2021-07-21 Thread Joshua Grauman

Hi all,

I see that qSort is deprecated in newer versions of Qt. I can also see 
that std::sort is intended to replace it. But I can't figure out how to 
use std::sort to sort a QList with a custom compare function. With qSort 
you could supply your own comparison function to sort however you wanted. 
I don't see how to do this with std::sort. Do you have to subclass and 
provide a operator< overload? I'd rather just define a comparison 
function, is this possible?


Thanks,

Josh

bool variantLessThan(const QVariant , const QVariant )
{
   return v1.toString() < v2.toString();
}

qSort(fieldsList.begin(), fieldsList.end(), variantLessThan);
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] QTimer and Qt::PreciseTimer

2017-07-29 Thread Joshua Grauman

Great. Helpful as always. Thanks!

Josh


On Saturday, 29 July 2017 13:02:20 PDT Joshua Grauman wrote:

Do you know offhand about how accurate typical PC system clocks are? I'm
wondering about how much drift there would be after an hour of recording
screencasts.


See the ntp drift file after ntpd has been running for a few days (/etc/
ntp.conf has the path).

The measurement should be in the order of ppm, unless you have a really crappy
hardware.

--
Thiago Macieira - thiago.macieira (AT) intel.com
 Software Architect - Intel Open Source Technology Center

___
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] QTimer and Qt::PreciseTimer

2017-07-29 Thread Joshua Grauman

Sorry, I'm seeing new things here.

I see under Linux that clock_gettime(), has options for CLOCK_MONOTONIC, 
and also CLOCK_MONOTONIC_RAW. CLOCK_MONOTONIC "is affected by the 
incremental adjustments performed by adjtime and NTP." So it seems that 
would be best? Which does QElapsedTimer use?


Thanks again!

Josh


Thiago,

Thanks, this is really helpful. This particular code is only used by me (I've 
added a module to my program to allow screencasting of my program with alpha 
channel so that it can be overlaid over video of me. Hence the need for the 
clock to be roughly synched to the camera clock so the video and screencast 
are in synch). So I am just trying to optimize the situation to get the best 
clock for me. So when I was reading about ntp, it sounded like it would 
gently adjust the time (speed up / slow down internal clock to synch with 
time), and thereby correct for drift over time. But it sounds like switching 
to QElapsedTimer is better.


Do you know offhand about how accurate typical PC system clocks are? I'm 
wondering about how much drift there would be after an hour of recording 
screencasts.


Josh



 On Friday, 28 July 2017 16:15:27 PDT Joshua Grauman wrote:
>  I have a related but different question.
> 
>  I am reading the time with QDateTime::currentMSecsSinceEpoch(). How

>  susceptible is this time to clock drift/jitter/etc. on Linux (Kubuntu
>  16.04.2)?

 It's susceptible to complete jumps. You're using the realtime clock.

>  I know ntpd is constantly updating the time, and there is some
>  error involved in this.

 How do you know that all your users are using ntpd? How do you know that
 they
 are in a network that allows NTP packets (it's UDP)?

 And how sure are you that the system won't run ntpdate on a whim once you
 connect to a network? (it shouldn't, but a lot of poorly-configured
 systems
 exist)

>  If I am reading the time from
>  QDateTime::currentMSecsSinceEpoch() and using it to set a QTimer every
>  40ms, how does ntpd constantly correcting the time going to affect this,
>  if at all?

 QTimer has nothing to do with the current wall-clock time. The Qt event
 loop
 uses the monotonic clock exclusively.

>  FYI: My timer slot basically looks like this:
> 
>  void myClass::animationTimerSlot(void)

>  {
> if(firstTime)
>   startTime=QDateTime::currentMSecsSinceEpoch();
> 
> dowork();
> 
> frameCnt++;

> int t = startTime + ((double)frameCnt*40.0) -
>  QDateTime::currentMSecsSinceEpoch(); if(t<0)
>   t=0;
> animTimer->start(t);
>  }

 Your code is susceptible to time jumps. If the clock went backwards for a
 second (for example), your t would be about 1000 and your animation would
 stop
 for a second.

 Use the monotonic clock instead.

 --
 Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

 ___
 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] QTimer and Qt::PreciseTimer

2017-07-29 Thread Joshua Grauman

Thiago,

Thanks, this is really helpful. This particular code is only used by me 
(I've added a module to my program to allow screencasting of my program 
with alpha channel so that it can be overlaid over video of me. Hence the 
need for the clock to be roughly synched to the camera clock so the video 
and screencast are in synch). So I am just trying to optimize the 
situation to get the best clock for me. So when I was reading about ntp, 
it sounded like it would gently adjust the time (speed up / slow down 
internal clock to synch with time), and thereby correct for drift over 
time. But it sounds like switching to QElapsedTimer is better.


Do you know offhand about how accurate typical PC system clocks are? I'm 
wondering about how much drift there would be after an hour of recording 
screencasts.


Josh



On Friday, 28 July 2017 16:15:27 PDT Joshua Grauman wrote:

I have a related but different question.

I am reading the time with QDateTime::currentMSecsSinceEpoch(). How
susceptible is this time to clock drift/jitter/etc. on Linux (Kubuntu
16.04.2)?


It's susceptible to complete jumps. You're using the realtime clock.


I know ntpd is constantly updating the time, and there is some
error involved in this.


How do you know that all your users are using ntpd? How do you know that they
are in a network that allows NTP packets (it's UDP)?

And how sure are you that the system won't run ntpdate on a whim once you
connect to a network? (it shouldn't, but a lot of poorly-configured systems
exist)


If I am reading the time from
QDateTime::currentMSecsSinceEpoch() and using it to set a QTimer every
40ms, how does ntpd constantly correcting the time going to affect this,
if at all?


QTimer has nothing to do with the current wall-clock time. The Qt event loop
uses the monotonic clock exclusively.


FYI: My timer slot basically looks like this:

void myClass::animationTimerSlot(void)
{
   if(firstTime)
 startTime=QDateTime::currentMSecsSinceEpoch();

   dowork();

   frameCnt++;
   int t = startTime + ((double)frameCnt*40.0) -
QDateTime::currentMSecsSinceEpoch(); if(t<0)
 t=0;
   animTimer->start(t);
}


Your code is susceptible to time jumps. If the clock went backwards for a
second (for example), your t would be about 1000 and your animation would stop
for a second.

Use the monotonic clock instead.

--
Thiago Macieira - thiago.macieira (AT) intel.com
 Software Architect - Intel Open Source Technology Center

___
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] QTimer and Qt::PreciseTimer

2017-07-28 Thread Joshua Grauman

I have a related but different question.

I am reading the time with QDateTime::currentMSecsSinceEpoch(). How 
susceptible is this time to clock drift/jitter/etc. on Linux (Kubuntu 
16.04.2)? I know ntpd is constantly updating the time, and there is some 
error involved in this. If I am reading the time from 
QDateTime::currentMSecsSinceEpoch() and using it to set a QTimer every 
40ms, how does ntpd constantly correcting the time going to affect this, 
if at all?


FYI: My timer slot basically looks like this:

void myClass::animationTimerSlot(void)
{
  if(firstTime)
startTime=QDateTime::currentMSecsSinceEpoch();

  dowork();

  frameCnt++;
  int t = startTime + ((double)frameCnt*40.0) - 
QDateTime::currentMSecsSinceEpoch();
  if(t<0)
t=0;
  animTimer->start(t);
}

Thanks!

Josh


On Wed, 26 Jul 2017, Thiago Macieira wrote:


On quarta-feira, 26 de julho de 2017 14:23:29 PDT Joshua Grauman wrote:

Thanks so much for the response.

So do I have this right then?

QTimer doesn't use any actually timers in the OS (no system
calls/interrupts). It is all handled internally by Qt's event loop. So if
the OS doesn't give Qt CPU time, it will miss a timer. Calling 'nice'
(Linux) on the process may help with this.


On Windows, it will use multimedia timers (timerSetEvent()) for precise
timers, SetTimer() for the others. How the OS services those, I don't have a
clue.[*]

I have a pending patch to make it use CLOCK_MONOTONIC_COARSE on Linux (and
CLOCK_MONOTONIC_FAST on BSDs), but I've run into some problems that some
timers wake up in the wrong order. The coarse and precise timers are not
sync'ed in the OS: even if you query the latter, the former may not update, so
it may look like the monotonic clock went backwards.

Until then, everything uses the same clock on Unix and simply depends on when
the OS wakes us up from ppoll().

[*] I have a vague memory of the regular timers having a 4 ms granularity.
--
Thiago Macieira - thiago.macieira (AT) intel.com
 Software Architect - Intel Open Source Technology Center

___
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] QTimer and Qt::PreciseTimer

2017-07-26 Thread Joshua Grauman

Thanks so much for the response.

So do I have this right then?

QTimer doesn't use any actually timers in the OS (no system 
calls/interrupts). It is all handled internally by Qt's event loop. So if 
the OS doesn't give Qt CPU time, it will miss a timer. Calling 'nice' 
(Linux) on the process may help with this.


Josh



On quarta-feira, 26 de julho de 2017 12:58:43 PDT Joshua Grauman wrote:

Hello all,

I have a QTimer in my application that runs every 40ms. It doesn't run
continuously, but I recall the start function every time my timer function
is done so that the timer doesn't drift over time. My question though is
about timeout overrun. If the system is busy, and so the timer is late,
will Qt::PreciseTimer be more likely to return on time than
Qt::CoarseTimer? In other words, I'm ok with the 5% accuracy of
Qt::CoarseTimer normally (when the system isn't busy), but when the 40ms
timer is getting close to 60ms, I want to avoid timer overrun.


The type of timer is not relevant. All timers behave the same way: if it's
serviced as soon as it's available and the next wake up will always be the
current time + interval (± coarseness, if applicable).

Qt does not control when the OS gives us CPU time to service the timers. If
you need that, you need to consult your OS API and create a high-priority
thread or process, something that usually requires privilege elevation. Qt
cannot help you there.


Does anyone have any more precise info about Qt::PreciseTimer than the
docs which say:

"All timer types may time out later than expected if the system is busy
or unable to provide the requested accuracy. In such a case of timeout
overrun, Qt will emit activated() only once, even if multiple timeouts
have expired, and then will resume the original interval."


There is no more info to be had.

--
Thiago Macieira - thiago.macieira (AT) intel.com
 Software Architect - Intel Open Source Technology Center

___
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 and Qt::PreciseTimer

2017-07-26 Thread Joshua Grauman

Hello all,

I have a QTimer in my application that runs every 40ms. It doesn't run 
continuously, but I recall the start function every time my timer function 
is done so that the timer doesn't drift over time. My question though is 
about timeout overrun. If the system is busy, and so the timer is late, 
will Qt::PreciseTimer be more likely to return on time than 
Qt::CoarseTimer? In other words, I'm ok with the 5% accuracy of 
Qt::CoarseTimer normally (when the system isn't busy), but when the 40ms 
timer is getting close to 60ms, I want to avoid timer overrun.


Does anyone have any more precise info about Qt::PreciseTimer than the 
docs which say:


"All timer types may time out later than expected if the system is busy 
or unable to provide the requested accuracy. In such a case of timeout 
overrun, Qt will emit activated() only once, even if multiple timeouts 
have expired, and then will resume the original interval."


Thanks!

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


[Interest] Black background with QPrinter

2017-03-16 Thread Joshua Grauman

Hi all,

I am trying to print a QTextDocument to PDF using QPrinter like the 
following. It works great. But now I'm trying to print to a PDF with a 
black background and I can't figure out how. If I do painter.fillRect() it 
doesn't cover the margins (margins are white). I've tried changing the 
document() stylesheet with no success. Does anyone know what is the best 
way to have a different color background for a PDF? Thanks!



void TextEdit::print(QPrinter *printer)
{
  QPainter painter;
  painter.begin(printer);

  float pageWidth=document()->size().width();
  float scale = printer->pageRect().width() / pageWidth;
  float pageHeight=printer->pageRect().height() / scale;

  document()->setPageSize(QSizeF(pageWidth, pageHeight));
  int pageCount=document()->pageCount();

  for(int page=0; pagedrawContents(, view);
  painter.restore();

if(page != pageCount-1)
  printer->newPage();
  }
  painter.end();
}
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] Recommended way to draw formatted text with QPainter

2016-12-17 Thread Joshua Grauman

Hello all,

I have a bunch of small fragments of formatted text (small paragraphs with 
multiple colors and fonts, using  tags). I need to paint them with 
QPainter at different locations (multiple rectangles of text) onto my 
widget. I've seen recommendations to put them in a QLabel and then call 
QLabel::render(), or to use QTextDocument and drawContents(). Are there 
any other ways to do it? Which is recommended for best results/fastest 
drawing? Thanks!


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


Re: [Interest] allocate QImage data in QSharedMemory

2016-12-12 Thread Joshua Grauman

Brilliant! How did I miss that constructor?!

Josh


Hi,Why not construct the image object from the shared memory buffer to begin 
with? Then lock the sm while drawing.
Look for example this constructor: http://doc.qt.io/qt-5/qimage.html#QImage-3

On Mon, Dec 12, 2016 at 11:45 PM, Joshua Grauman <jnf...@grauman.com> wrote:
  Hello all,

  I have been able to generate a screen capture of my program by rendering 
a window into a QImage at 30fps (called from QTimer), and then copying the 
QImage to shared memory
  (QSharedMemory) where another program grabs the frames and outputs them 
to ffmpeg. It all works great.

  However, my cpu is barely keeping up if I do much on my app.

  One of the ways I thought of to speed it up is to avoid the memcpy from 
the QImage (img) to QSharedMemory (sharedMemory) by deriving from QImage to a 
new class
  (QSharedMemoryImage) which allocates its image data in shared memory to 
begin with so that the window->render() function renders the window right into 
shared memory so the copy
  isn't necessary. QImage was a bit too complex for me to figure out how to 
do this.

  For you experts, is this possible? How hard would it be?

  Here's the relevant code in the QTimer:

    window->render(, QPoint(), QRegion(), QWidget::DrawChildren);
    sharedMemory.lock();
    char *to = (char*)sharedMemory.data();
    const unsigned char *from = img.constBits();
    memcpy(to, from, sharedMemory.size());
    sharedMemory.unlock();

  Josh
  ___
  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] allocate QImage data in QSharedMemory

2016-12-12 Thread Joshua Grauman

Hello all,

I have been able to generate a screen capture of my program by rendering a 
window into a QImage at 30fps (called from QTimer), and then copying the 
QImage to shared memory (QSharedMemory) where another program grabs the 
frames and outputs them to ffmpeg. It all works great.


However, my cpu is barely keeping up if I do much on my app.

One of the ways I thought of to speed it up is to avoid the memcpy from 
the QImage (img) to QSharedMemory (sharedMemory) by deriving from QImage 
to a new class (QSharedMemoryImage) which allocates its image data in 
shared memory to begin with so that the window->render() function renders 
the window right into shared memory so the copy isn't necessary. QImage 
was a bit too complex for me to figure out how to do this.


For you experts, is this possible? How hard would it be?

Here's the relevant code in the QTimer:

  window->render(, QPoint(), QRegion(), QWidget::DrawChildren);
  sharedMemory.lock();
  char *to = (char*)sharedMemory.data();
  const unsigned char *from = img.constBits();
  memcpy(to, from, sharedMemory.size());
  sharedMemory.unlock();

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


Re: [Interest] QMenu size

2016-11-15 Thread Joshua Grauman

Bo,

Thanks! These are great ideas. It's not about making it work like another 
system, but it is a unique requirement having to do with recording the 
screen...


If you don't mind, could you clarify a bit what you mean with a couple of 
your suggestions?



- Work with the width for height tricks


What does this mean?

- You can move the menu after it appears with either a reimplementation in 
the resizeEvent, eventFilter on resize or other events, or using 0 time 
single shot timer


I understand the first two of these, but where would I implement a 0 time 
single shot?


Thanks again so much!!!

Josh

On Tue, 15 Nov 2016, Bo Thorsen wrote:


Den 08-11-2016 kl. 23:05 skrev Joshua Grauman:

 Hello all,

 I am wondering if there is a way to customize the size of a QMenu used
 as a context menu. I have it so that when I right click, a popup menu
 comes up. But I would like it so the QMenu doesn't ever go outside of
 the window it is clicked in. Right now, if you click near the bottom,
 the QMenu drops below my app. Or if I have a QMenu with a lot of items,
 it breaks it up into two columns worth of items, is there a way to make
 that more (for a wider and less tall sub-QMenu)? Thanks for any thoughts.


This sounds to me like you are trying to force Qt to do something that some 
other system used to do?


I have a lot of requests from customers and I always try to make them accept 
that the default way of doing things are there for a number of reasons and 
they should accept it the it is. So, my advice is to stop thinking about 
this. Or make the guy deciding this stop thinking about it :)


However, if you can't do that, you always have options. Here are a set of 
some of the things I would try:


- Set the maximum height on the QMenu

- Work with the width for height tricks

- You can move the menu after it appears with either a reimplementation in 
the resizeEvent, eventFilter on resize or other events, or using 0 time 
single shot timer


- There are probably a bunch of possible hacks that might work in the area of 
proxy QStyle subclasses


I hope this helps.

Bo Thorsen,
Director, Viking Software.

--
Viking Software
Qt and C++ developers for hire
http://www.vikingsoft.eu
___
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] Moc file won't compile on Android

2016-11-11 Thread Joshua Grauman

Hello all,

I am working on compiling a test program for Android. It uses 
qttoolbardialog from 
Qt5.6.2-Android/5.6/Src/qttools/src/shared/qttoolbardialog. The files are 
included in the .pro file like:


SOURCES += qttoolbardialog.cpp
HEADERS += qttoolbardialog.h
FORMS += qttoolbardialog.ui
RESOURCES += qttoolbardialog.qrc

It all works fine for the desktop version(s). But when I try to compile 
the same project for Android (using Qt Creator, which works fine for other 
projects), the moc file won't compile. The compiler output is below. Does 
anyone know what is going on??


Thanks!

Josh



/opt/android-ndk-r12b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ 
-c -fstack-protector-strong -DANDROID -march=armv7-a -mfloat-abi=softfp 
-mfpu=vfp -fno-builtin-memmove 
--sysroot=/opt/android-ndk-r12b/platforms/android-9/arch-arm/ -O2 -Os 
-mthumb -std=gnu++11 -Wall -W -D_REENTRANT -fPIC -DVER5 -DQT_NO_DEBUG 
-DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_XML_LIB 
-DQT_NETWORK_LIB -DQT_CORE_LIB -I../maincode-dev -I. 
-I/opt/Qt5.6.2-Android/5.6/android_armv7/include 
-I/opt/Qt5.6.2-Android/5.6/android_armv7/include/QtPrintSupport 
-I/opt/Qt5.6.2-Android/5.6/android_armv7/include/QtWidgets 
-I/opt/Qt5.6.2-Android/5.6/android_armv7/include/QtGui 
-I/opt/Qt5.6.2-Android/5.6/android_armv7/include/QtXml 
-I/opt/Qt5.6.2-Android/5.6/android_armv7/include/QtNetwork 
-I/opt/Qt5.6.2-Android/5.6/android_armv7/include/QtCore -I. -I. -isystem 
/opt/android-ndk-r12b/sources/cxx-stl/gnu-libstdc++/4.9/include -isystem 
/opt/android-ndk-r12b/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include 
-isystem /opt/android-ndk-r12b/platforms/android-9/arch-arm/usr/include 
-I/opt/Qt5.6.2-Android/5.6/android_armv7/mkspecs/android-g++ -o 
moc_qttoolbardialog.o moc_qttoolbardialog.cpp
moc_qttoolbardialog.cpp: In static member function 'static void 
QtToolBarDialog::qt_static_metacall(QObject*, QMetaObject::Call, int, 
void**)':
moc_qttoolbardialog.cpp:187:29: error: invalid use of incomplete type 
'class QtToolBarDialogPrivate'

 case 0: _t->d_func()->newClicked(); break;
 ^
In file included from moc_qttoolbardialog.cpp:9:0:
../maincode-dev/qttoolbardialog.h:88:7: error: forward declaration of 
'class QtToolBarDialogPrivate'

 class QtToolBarDialogPrivate;
   ^
moc_qttoolbardialog.cpp:188:29: error: invalid use of incomplete type 
'class QtToolBarDialogPrivate'

 case 1: _t->d_func()->removeClicked(); break;
 ^
In file included from moc_qttoolbardialog.cpp:9:0:
../maincode-dev/qttoolbardialog.h:88:7: error: forward declaration of 
'class QtToolBarDialogPrivate'

 class QtToolBarDialogPrivate;
   ^
moc_qttoolbardialog.cpp:189:29: error: invalid use of incomplete type 
'class QtToolBarDialogPrivate'

 case 2: _t->d_func()->defaultClicked(); break;
 ^
In file included from moc_qttoolbardialog.cpp:9:0:
../maincode-dev/qttoolbardialog.h:88:7: error: forward declaration of 
'class QtToolBarDialogPrivate'

 class QtToolBarDialogPrivate;
   ^
moc_qttoolbardialog.cpp:190:29: error: invalid use of incomplete type 
'class QtToolBarDialogPrivate'

 case 3: _t->d_func()->okClicked(); break;
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] QMenu size

2016-11-08 Thread Joshua Grauman

Hello all,

I am wondering if there is a way to customize the size of a QMenu used as 
a context menu. I have it so that when I right click, a popup menu comes 
up. But I would like it so the QMenu doesn't ever go outside of the window 
it is clicked in. Right now, if you click near the bottom, the QMenu drops 
below my app. Or if I have a QMenu with a lot of items, it breaks it up 
into two columns worth of items, is there a way to make that more (for a 
wider and less tall sub-QMenu)? Thanks for any thoughts.


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


[Interest] rendering QTreeView bug

2016-10-31 Thread Joshua Grauman

Hello all,

I have a QTreeView with a custom TreeModel. It works really well and I 
haven't had any problems with it after exhaustive testing. The QTreeView 
is in a widget inside a layout. It all looks great and works perfectly on 
screen. However, when I try to render the widget to a QImage to save, the 
QTreeView doesn't render properly at all. The rest of the widgets in the 
window render fine, the top row of the QTreeView renders right, but all 
the rest of the rows are badly distorted (squished vertically), and not 
drawn properly. Here is the code I use to render the entire window. I run 
this code inside of a timer (ie. not in the paint event).


mainWin->render(, QPoint(), QRegion(), QWidget::DrawChildren);

Thanks for any ideas as to what is going on!

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


Re: [Interest] Qt mouse poll rate too slow

2016-09-23 Thread Joshua Grauman

Thanks, this is the issue. At least I'm not the only one!

Josh

Hi,I think mouse events are subject to compression, so you might be 
getting only part of the real number of "mouse moves" if Qt decides it 
can't keep up with the speed.For example this bugreport[1] looks 
relevant.


[1]: https://bugreports.qt.io/browse/QTBUG-44964

I hope that helps.
Kind regards.

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


[Interest] Qt mouse poll rate too slow

2016-09-23 Thread Joshua Grauman

Hello all,

I'm running into a problem where the mouse (and touchscreen) poll rate is 
too slow for my application. At first I thought it was the device (mouse 
and/or touchscreen), but after trying in different apps, I discovered it 
is Qt. I am simply subclassing a QLabel and adding points to a 
QPainterPath in mouseMoveEvent like this:


MyLabel::mouseMoveEvent(QMouseEvent *e)
{
  if(mouseState==1)
  {
addPoint(e->pos());
update();
  }
}

The QPainterPath looks fine when you move the mouse/touchscreen slowly, 
but when moving quickly you can see discrete points at quite a distance 
apart. Is there any way to get Qt to poll faster? Any other ideas for 
getting better precision for mouse events? Thanks!


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


Re: [Interest] Qt5.6.1 16-bit color on Raspberry Pi 3

2016-09-13 Thread Joshua Grauman
Nevermind, apparently it was just the default theme that is dithered. 
Explicitly setting the theme to fusion fixed it.


Josh


Hello,

I have been working for hours trying to figure out how to get 24 or 32-bit 
color on my Raspberry Pi 3. Currently, Qt is running at 16-bit color and 
everything is dithered and looks terrible. As far as I can tell, X and the 
framebuffer are both running at 24 bit and I think it is only Qt running at 
16 bit. I compiled Qt myself (twice) natively on the Raspberry Pi trying 
different options, and I have the same results. I used the EGLFS for 
Raspberry Pi plugin on one compile, and another ran directly on X. I'm 
running Ubuntu Mate 16.04.1 LTS. Is it necessary to compile Qt for 24-bit 
color? What compile options affect this? Are there commandline options that 
can for 24-bit? Thanks for any info on how to get out of 16-bit color!


Josh
___
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] Qt5.6.1 16-bit color on Raspberry Pi 3

2016-09-13 Thread Joshua Grauman

Hello,

I have been working for hours trying to figure out how to get 24 or 32-bit 
color on my Raspberry Pi 3. Currently, Qt is running at 16-bit color and 
everything is dithered and looks terrible. As far as I can tell, X and the 
framebuffer are both running at 24 bit and I think it is only Qt running 
at 16 bit. I compiled Qt myself (twice) natively on the Raspberry Pi 
trying different options, and I have the same results. I used the EGLFS 
for Raspberry Pi plugin on one compile, and another ran directly on X. I'm 
running Ubuntu Mate 16.04.1 LTS. Is it necessary to compile Qt for 24-bit 
color? What compile options affect this? Are there commandline options 
that can for 24-bit? Thanks for any info on how to get out of 16-bit 
color!


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


[Interest] QSharedMemory example has excessive copies?

2016-09-02 Thread Joshua Grauman

Hello,

I'm looking to use QSharedMemory to grab an image from a widget into 
shared memory (using QWidget::grab() or QWidget::render()), so another 
process/program can process the images.


So I'm looking at the QSharedMemory example here:
http://doc.qt.io/qt-5/qtcore-ipc-sharedmemory-example.html

It looks to me like the process that loads the image from the file into 
shared memory has 3 deep copies. Maybe implicit sharing reduces that, I'm 
not sure. But on the surface, it looks like 1) the file is loaded into a 
QImage using image.load(fileName). Then 2) the QImage is streamed into a 
QBuffer using out << image; And finally, 3) the buffer is memcopied into 
shared memory.


So... isn't there an Qt way to do this with 1 copy? It would be trivial to 
load an image from a file straight into shared memory in straight C. And 
more importantly, is there a way to grab a widget image data (including 
alpha channel) straight into shared memory? I'd prefer a Qt way of doing 
this, but I'd also accept hacks as this doesn't need to be portable. I'm 
just trying to grab a widget 30 frames a second from my Qt app and convert 
it to video.


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


[Interest] Mac OS defines

2014-03-01 Thread Joshua Grauman
I've tried to google and find the proper defines to use for different Mac 
related operating systems. Does anyone know offhand which defines to 
use for which OSes (moving forward for Qt 5.2+)?

Is this correct?

Q_OS_MAC  - Mac OSX and iOS
Q_OS_MACX - Mac OSX
Q_OS_OSX  - Mac OSX (any difference with Q_OS_MACX, are both valid?)
Q_OS_IOS  - Mac iOS

Thanks.

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


[Interest] Widen down-arrow of QComboBox

2013-12-29 Thread Joshua Grauman
Hello all,

I'm trying to get the down arrow of a QComboBox to be wider than the 
default. I've tried lots of different ideas and none are working as 
expected. I'm using the Fusion style and Qt5.2. If possible, I'd like to 
keep having the style draw everything and not have to redo all the 
painting myself.

The best I've come across is subclassing QProxyStyle and reimplementing 
subControlRect() for the ComboBoxArrow as follows. This almost works, but 
when the ComboBox is editable, then the lineEdit doesn't change size and 
overdraws the down arrow button (maybe a bug in the style?). I've tried 
playing with different features of the style and none that I've found are 
able to control this parameter.

QRect subControlRect(QStyle::ComplexControl cc, const QStyleOptionComplex 
*option, QStyle::SubControl sc, const QWidget *widget) const
{
   if(cc == CC_ComboBox  sc == SC_ComboBoxArrow)
 return(QRect(widget-width()-widget-height(),0,widget-height(), 
widget-height()));
   return QProxyStyle::subControlRect(cc, option, sc, widget);
}

I also tried using a style sheet as follows, but this changes the image, 
but not the width of the down-arrow for some reason:
   QComboBox::down-arrow {width:60px; height:60px; image: url(./test.png);}

Thanks for any ideas!

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


[Interest] Enabling Harfbuzz on Mac for Qt5

2013-11-21 Thread Joshua Grauman
Hello,

Does anyone know if anything changed with respect to enabling Harfbuzz on 
Qt/Mac with Qt version 5? With the precompiled releases what is the 
default setting? Do I need to set the environment variable 
QT_ENABLE_HARFBUZZ? Is there a (programatic) way to check and verify if it 
has been enabled properly?

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


[Interest] Best practice for sorting multiple (connected) QLists

2013-11-19 Thread Joshua Grauman
I fairly often find myself wanting to sort a bit of data. Imagine I have a 
few QListint's a QStringList's and that they correspond like a database 
table so that I always append to all the lists together with data for one 
row. Something like:

QListint age, height;
QStringList firstname, lastname;
while(data)
{
age.append(getData1());
height.append(getData2());
firstname.append(getData3());
lastname.append(getData4());
}

Now what if I want to sort all that data, (say by age) so that I can print 
out all the first and last names in order according to age.

I've tried different ways of doing this, but they all seem a bit 
contrived. The best I've come up with is to have another QMapint, int 
that maps the sorting order to the indices like:

QListint age, height;
QStringList firstname, lastname;
QMapint, int order;
while(data)
{
age.append(getData1());
height.append(getData2());
firstname.append(getData3());
lastname.append(getData4());
order[age.last()] = age.size()-1;
}

QListint orderedIndices = order.values();

for(int i=0; iorderedIndices.size(); i++)
{
   print(firstname[orderedIndices[i]], lastname[orderedIndices[i]]);
}

It's not too bad. I'm not worried about performance, most of the time 
these are just small amounts of data that don't warrant creating a new 
class to handle, or creating a database for. I'm just wondering if anyone 
has a cleaner way of handling this? What do you do for these types of 
situations?

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


[Interest] macdeployqt for Qt5.2beta issues on OSX Lion

2013-11-13 Thread Joshua Grauman
I just finished getting my app ready to run with Qt5.2beta and OSX Lion 
and everything is running fine. However, after I run macdeployqt, I can't 
run the app by double clicking on it, it just immediately crashes. When I 
run it from the terminal it is fine. I ran otool -L on the binary and 
everything looked good, and macdeployqt worked fine for me with Qt5.0.1. 
The only change I could think of besides switching to Qt5.2beta is that 
I'm now invoking clang directly via make (ie. just running qmake without 
options which generates a Makefile and then make), rather than running 
qmake with options to create an xcode project, and then running the 
xcodebuild.

I can't think of any reason why running on the commandline would work, but 
running by double clicking the icon wouldn't. Does anyone have any ideas 
about what else to check? Thanks so much!

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


Re: [Interest] QPrinter Support on Android

2013-11-12 Thread Joshua Grauman
FYI: I got a response from Bogdan, and he said that basically it was just 
disabled to get it to compile in hurrying to get Android support working 
in Qt5.2. However, he did say that with Android 4.4 (KitKat) having proper 
print support, he's hoping to have print support in Qt5.3/Android...

Thanks!

Josh

 On 11 November 2013 08:07, Thiago Macieira thiago.macie...@intel.com wrote:
 On domingo, 10 de novembro de 2013 21:34:08, Joshua Grauman wrote:
 Hello all,

 I just tried Qt5.2 for Android and unless I'm missing something I can't
 use QPrinter. Now I understand the reason for this, obviously there is no
 printer backend on Android. However, when I used Qt 4.x for Android using
 Bogdan's version, I was still able to use QPrinter and friends, and then I
 can at least create a QPrintPreviewWidget, export to PDF, etc. Unless I'm
 missing something this isn't possible with Qt 5.2 for Android. Does anyone
 know more about this? Thanks!

 Are you sure it's disabled? I can't see anything in the build that would
 disable QtPrintSupport.

 git grep QT_NO_PRINTER shows:

 mkspecs/android-g++/qmake.conf:
DEFINES+= QT_NO_PRINTER QT_NO_PRINTDIALOG
 mkspecs/common/linux-android.conf:
DEFINES+= QT_NO_PRINTER QT_NO_PRINTDIALOG
 mkspecs/unsupported/android-g++/qmake.conf:
DEFINES+= QT_NO_PRINTER QT_NO_PRINTDIALOG

 So it's been disabled by the Android maintainers in the configure, you
 will need to ask them why.  In the interim, if you're only needing to
 write PDF's then we provide the QPdfWriter class for that purpose.  As
 for proper print support in Android (IPP, CloudPrint, etc) then the
 earliest I could see that happening is 5.4, i.e. at least a year away.

 Cheers!

 John.
 ___
 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] QPrinter Support on Android

2013-11-10 Thread Joshua Grauman
Hello all,

I just tried Qt5.2 for Android and unless I'm missing something I can't 
use QPrinter. Now I understand the reason for this, obviously there is no 
printer backend on Android. However, when I used Qt 4.x for Android using 
Bogdan's version, I was still able to use QPrinter and friends, and then I 
can at least create a QPrintPreviewWidget, export to PDF, etc. Unless I'm 
missing something this isn't possible with Qt 5.2 for Android. Does anyone 
know more about this? Thanks!

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


Re: [Interest] QCamera and QCameraViewFinder

2013-11-08 Thread Joshua Grauman
Thanks so much.

I may be missing something, but is there an easy way to convert 
QVideoFrame to QImage? I can't see one.

Also note that the Qt example code also has this problem:
http://qt-project.org/doc/qt-5.0/qtmultimedia/multimediawidgets-camera.html

also note that the basic code I posted was example code from Qt 
Documentation...

Thanks!

Josh

 Oh, I overlooked the code sample you provided.

 You should listen to the imageAvailable() signal instead of 
 imageCaptured(). What you get from imageCaptured() is just a preview, 
 it's emitted right after the camera sensor captured the image but at 
 this point the final image is not processed yet. That final image is 
 provided by imageAvailable(). You'll notice it's a QVideoFrame and 
 you'll have to convert it to a QImage if that's what you need.

 Yoann Lopes
 Senior Software Engineer - Digia, Qt
 Visit us on: http://qt.digia.com

 On Nov 5, 2013, at 7:09 PM, Joshua Grauman wrote:

 Sorry, I'm using Qt5.2beta under Linux.

 Josh

 Which platform are you on?

 Yoann Lopes
 Senior Software Engineer - Digia, Qt
 Visit us on: http://qt.digia.com

 On Nov 5, 2013, at 7:14 AM, Joshua Grauman wrote:

 Hello all,

 I setup a basic use of QCamera and QCameraViewFinder that work fine. I
 just used the basic example in the docs to capture an image like this:

 camera-searchAndLock();  //on half pressed shutter button
 imageCapture-capture();  //on shutter button pressed
 camera-unlock(); //on shutter button released

 and had setup the viewfinder and camera like this:

 camera = new QCamera;
 viewFinder = new QCameraViewfinder(picture1);
 viewFinder-setSizePolicy(QSizePolicy::Maximum,QSizePolicy::Maximum);
 viewFinder-setGeometry(picture1-geometry());
 imageCapture = new QCameraImageCapture(camera);
 connect(imageCapture, SIGNAL(imageCaptured(int, const QImage )), this, 
 SLOT(gotImage(int, const QImage )));
 camera-setViewfinder(viewFinder);
 imageCapture-setCaptureDestination(QCameraImageCapture::CaptureToBuffer);
 camera-setCaptureMode(QCamera::CaptureStillImage);

 Everything works as expected. The problem is with the exposure settings.
 The viewfinder looks how I want it to (properly exposed). But when I
 capture the image, it is under-exposed (very dark). I was hoping to get
 the picture that is taken to have the same exposure settings as the
 viewfinder since it looks fine. Does anyone know why the default settings
 for QCamera would be under-exposed in comparison to the viewfinder?
 Thanks!

 Josh
 ___
 Interest mailing list
 Interest@qt-project.orgmailto:Interest@qt-project.orgmailto: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] QCamera and QCameraViewFinder

2013-11-05 Thread Joshua Grauman
Sorry, I'm using Qt5.2beta under Linux.

Josh

 Which platform are you on?

 Yoann Lopes
 Senior Software Engineer - Digia, Qt
 Visit us on: http://qt.digia.com

 On Nov 5, 2013, at 7:14 AM, Joshua Grauman wrote:

 Hello all,

 I setup a basic use of QCamera and QCameraViewFinder that work fine. I
 just used the basic example in the docs to capture an image like this:

 camera-searchAndLock();  //on half pressed shutter button
 imageCapture-capture();  //on shutter button pressed
 camera-unlock(); //on shutter button released

 and had setup the viewfinder and camera like this:

 camera = new QCamera;
 viewFinder = new QCameraViewfinder(picture1);
 viewFinder-setSizePolicy(QSizePolicy::Maximum,QSizePolicy::Maximum);
 viewFinder-setGeometry(picture1-geometry());
 imageCapture = new QCameraImageCapture(camera);
 connect(imageCapture, SIGNAL(imageCaptured(int, const QImage )), this, 
 SLOT(gotImage(int, const QImage )));
 camera-setViewfinder(viewFinder);
 imageCapture-setCaptureDestination(QCameraImageCapture::CaptureToBuffer);
 camera-setCaptureMode(QCamera::CaptureStillImage);

 Everything works as expected. The problem is with the exposure settings.
 The viewfinder looks how I want it to (properly exposed). But when I
 capture the image, it is under-exposed (very dark). I was hoping to get
 the picture that is taken to have the same exposure settings as the
 viewfinder since it looks fine. Does anyone know why the default settings
 for QCamera would be under-exposed in comparison to the viewfinder?
 Thanks!

 Josh
 ___
 Interest mailing list
 Interest@qt-project.orgmailto: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] QCamera and QCameraViewFinder

2013-11-04 Thread Joshua Grauman
Hello all,

I setup a basic use of QCamera and QCameraViewFinder that work fine. I 
just used the basic example in the docs to capture an image like this:

camera-searchAndLock();  //on half pressed shutter button
imageCapture-capture();  //on shutter button pressed
camera-unlock(); //on shutter button released

and had setup the viewfinder and camera like this:

camera = new QCamera;
viewFinder = new QCameraViewfinder(picture1);
viewFinder-setSizePolicy(QSizePolicy::Maximum,QSizePolicy::Maximum);
viewFinder-setGeometry(picture1-geometry());
imageCapture = new QCameraImageCapture(camera);
connect(imageCapture, SIGNAL(imageCaptured(int, const QImage )), this, 
SLOT(gotImage(int, const QImage )));
camera-setViewfinder(viewFinder); 
imageCapture-setCaptureDestination(QCameraImageCapture::CaptureToBuffer);
camera-setCaptureMode(QCamera::CaptureStillImage);

Everything works as expected. The problem is with the exposure settings. 
The viewfinder looks how I want it to (properly exposed). But when I 
capture the image, it is under-exposed (very dark). I was hoping to get 
the picture that is taken to have the same exposure settings as the 
viewfinder since it looks fine. Does anyone know why the default settings 
for QCamera would be under-exposed in comparison to the viewfinder? 
Thanks!

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


Re: [Interest] C++11 support on Qt5 platforms

2013-10-29 Thread Joshua Grauman
Can you use any version of the Android NDK with the Qt SDK (ie. using Qt 
Creator and not recompiling Qt source)?

Josh

FYI:

The latest Android NDK (Revision 9, July 2013) added GCC 4.8, although GCC 
4.6 is still the default...

From the NDK Website:

Android NDK, Revision 9 (July 2013)

Added GNU Compiler Collection (GCC) 4.8 compiler to the NDK. Since GCC 4.6 
is still the default, you must explicitly enable this option.

On Mon, 28 Oct 2013, Thiago Macieira wrote:

 On segunda-feira, 28 de outubro de 2013 14:44:02, Joshua Grauman wrote:
 Hello,

 I am wondering if there are any potential issues with using C++11 (I want
 to use lamba functions for connecting to signals) on all the major Qt5
 platforms --without recompiling the source--. I know the default
 Linux/Mac/WindowsMSVC compilers should be fine, but I'm more wondering
 about Windows via MingGW and the Android and iOS cross compilers. If I'm
 using Qt5.2 on all these platforms, should I pretty much be fine just to
 add CONFIG += c++11 to my .pro file and I'm good to go on all the
 platforms using the standard installers? Thanks!

 That depends on your compiler.

 Lambdas have been supported since GCC 4.5, Clang 3.1, MSVC 2010.

 We are currently shipping GCC 4.8 for MinGW, so it should be fine.

 For Android and iOS, you need to check what versions of the compiler are
 available in the SDKs and NDKs for those platforms. We don't ship the
 compilers. Apple keeps their Clang version quite up-to-date, even if
 completely branched off from the Clang mainline. That's not the case for the
 Android NDK though.


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


[Interest] C++11 support on Qt5 platforms

2013-10-28 Thread Joshua Grauman
Hello,

I am wondering if there are any potential issues with using C++11 (I want 
to use lamba functions for connecting to signals) on all the major Qt5 
platforms --without recompiling the source--. I know the default 
Linux/Mac/WindowsMSVC compilers should be fine, but I'm more wondering 
about Windows via MingGW and the Android and iOS cross compilers. If I'm 
using Qt5.2 on all these platforms, should I pretty much be fine just to 
add CONFIG += c++11 to my .pro file and I'm good to go on all the 
platforms using the standard installers? Thanks!

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


[Interest] Getting QTextDocument page break positions

2013-06-03 Thread Joshua Grauman
Hello all,

I have a QTextEdit/QTextDocument that I want to print. I call 
document()-setPageSize(QSizeF(pageWidth,pageHeight)); to set the page 
size and can print it fine. I have some custom drawing I need to do though 
and so I need to have a reliable way to see where QTextDocument did the 
page breaks. I would love to get a QListint of all the y positions where 
QTextDocument put in the page breaks. Does anyone have an elegant solution 
for this? Thanks!

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


[Interest] Qt5.1 for iOS

2013-04-09 Thread Joshua Grauman
Hello all,

I'm interested in diving into using Qt5.1 on iOS. Before I do though (I'm 
not a Mac or iOS user) I have two quick newbie questions for iOS:

1) I keep hearing that iOS is locked down or a walled garden. If I buy 
an iPad or whatever, is it pretty easy for me to compile/build my app and 
load onto my device? (I do have a Mac for development purposes, but no 
iPad/iPhone yet). How is this normally done?

2) Once I have built/developed my app, is there any way to get my app onto 
other devices (besides the App store)? Can people download my app if their 
OS isn't jailbroken, or does it have to go through the App Store? Is there 
a way for users to put the app on their own iPad/iPhone (through USB for 
example)?

Thanks!

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


Re: [Interest] QTBUG-150... Change word separators for QTextCursor (QPlainTextEditor)

2013-03-14 Thread Joshua Grauman
Scott,

I'm not certain that all these functions exist in QPlainTextEdit, but I'll 
tell you how I did it in QTextEdit by subclassing QTextEdit and 
reimplementing QTextEdit::mouseDoubleClickEvent(QMouseEvent *e). I get the 
position of the mouse click via e-pos(), and then get a QTextCursor using 
QTextEdit::cursorForPosition(const QPoint ). At that point you just need 
to walk backward and forward as far as you want and until you hit whatever 
word separator you want, and then set the text cursor, or (in my case), 
use setExtraSelections() to do more complex selections... Hope that helps.

Josh


 So I have a direct need for the QTBUG-150

 https://bugreports.qt-project.org/browse/QTBUG-150?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

 Which basically was as request to allow for a developer defined word 
 separator in QPlainTextEdit...

 While the original bug filer, and myself have 100% different needs (they 
 wanted to be able to select portions of a regular expression, mine is for a 
 file name) the need is still there...

 However, Gunner Sletta, comment This is easily done by users implementing 
 their own selection based on their own criteria flippant response is 1) 
 wrong.. If it was so easy, we would figure it out.. 2) violates the code less 
 develop more philosophy..

 My question, how do I follow Gunner's suggestion... I need to customize the 
 double click functionality, ie, change the word boundaries...


 Scott

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


Re: [Interest] mouse gestures

2013-03-09 Thread Joshua Grauman
I'm not sure if this is relevant, but the tap and hold gesture works with 
the mouse for me on multiple platforms, but I haven't tried other 
gestures.

Josh

 Hello, guys.

 I just did a fresh pull from GIt, ran the example, and got  nothing.

 Also, when I attempted the doubleclick event (after adding #include
 QMouseEvent to the header file, it was missing) I got no response on a
 doubleclick Action either.

 I did build the new qt5/qtbase/src/widgets/kernel/QWindowContainer, but
 (of course) it is never instantiated by the current example.

 Shawn, may I open a bug on this example, and use it to track the
 creation of code which works? I'll tentatively assign to myself, and try
 to create
 a version of the widget-based example which works with current 5.1-pre.
 I'll post a BugID to the list, if that's OK

 If this is acceptable, and it turns out to be impossible to resolve by
 changes in the example code (i.e., requiring changes to a Qt itself,
 then I'll create a subsequent Bug/RFE as a follow-up to that one.
 I accept that use of Gestures in Widget-based Applications is not widely
 used; but (IMO) we should either declare it to be unsupported, OR create
 the bug report -- even if it turns out to be a somewhat long-lived bug,
 due to lack of a competent Developer.

 Shawn, is my Opinion valid? I'm aware of the plan to Close bugs on the
 basis of stale, no activity, but this would at least have (at worst) a
 Closed Bug in the system for people to find.

 Mathias, if you can create a working version, feel free to attach to the
 Bug which I create, or send me an email with a tarfile attached (this is
 a genuine email address).


 On 03/08/2013 06:30 AM, Matthias Fuchs wrote:
 Hi Rutledge,

 On 06.03.2013 13:49, Rutledge Shawn wrote:
 On 5 Mar 2013, at 2:01 PM, Matthias Fuchs wrote:

 Hi,

 im am playing around with the imagegestures example and noticed
 that I do not get any gesture events from a traditional mouse
 device. Is this how it should behave? Do gestures only work with
 touch or even multitouch input devices?

 Is the a simple way to make the above example work with a mouse?
 I'm not getting that example to work with touch either; are you?
 Didn't try.
 The gestures framework isn't being used or maintained much, AFAIK.
 It's currently better to use Qt Quick for such things.  There are a
 couple of example photo gallery apps:
 qtdeclarative/examples/quick/demos/photoviewer (which has interaction
 kindof like this one, but gets photos from flickr) and
 qtdeclarative/examples/quick/demos/photosurface, which I wrote, and
 which does handle the mouse.  I have a patch to make photoviewer
 mouse-friendly too, but wasn't satisfied with the behavior yet.
 https://codereview.qt-project.org/#change,44323

 Ok, this sounds that I have to force migration to Qt Quick :-)
 The problem is that the application is completely Qt widget based so far
 and I hoped to get some gesture support in it. Let's say to switch
 between tabs in a QTabDialog by wiping.

 But when I understood Gunnar Sletta's blog post about
 QWidget::createWindowContainer() correctly, Qt 5.1 will bring some way
 of mixing Qt Widget based application with Qt Quick.

 I will play with it a little.

 Thanks
 Matthias




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


Re: [Interest] Persistent Editor keep focus when opening new window

2013-02-24 Thread Joshua Grauman
Great idea. Thanks so much for the help.

Josh

 On 02/23/2013 07:43 PM, Joshua Grauman wrote:
 Bill,

 Thanks so much, that looked like it should do the trick. But
 onfortunately, when my new window pops up (even with those flags, I tried
 both Qt::Dialog and Qt::Popup), the delegate still looses focus and thus
 is deleted... Thanks so much though. If it matters, I'm using Qt5.0.1 on
 Linux.


 Me, 4.7.1 on Linux.

 ...and I verified the solution I posted was what I
 had to do to solve the problem in my case.

  I reversed the Qt::Dialog/Qt::Popup flags and the
  problem re-emerged; The original editor window closed
  when I opened the secondary window.

 Perhaps you could override ::event on the primary window
 and block the event which is telling it to close?

 Bill

 Josh

 On 02/23/2013 04:40 PM, Joshua Grauman wrote:
 Hello all,

 I have a QTableWidget that uses a custom delegate. When I double click on
 a cell, the editor comes up fine. But then I want to be able to pull up a
 helper widget/window to enter data into the persistent editor. The problem
 is, when I show the new widget/window, the QTableWidget looses focus and
 the persistent editor is destroyed. Does anyone have any idea of how to
 bring up a new widget/window while still editing the persistent editor
 delegate? Thanks.


 Josh:

 I had the same problem, but don't remember which, of the hundreds
 of lines of code I have had to write to trick Qt into giving me the
 behavior I want, was added to fix this problem.

 I think it was this (on the custom editor window) :

 Qt::WindowFlags flags = windowFlags();
 flags |= Qt::Dialog;
 // flags |= Qt::Popup;
 setWindowFlags(flags);
 setWindowModality(Qt::ApplicationModal);

 Bill

 Josh
 ___
 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

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


Re: [Interest] Persistent Editor keep focus when opening new window

2013-02-23 Thread Joshua Grauman
Bill,

Thanks so much, that looked like it should do the trick. But 
onfortunately, when my new window pops up (even with those flags, I tried 
both Qt::Dialog and Qt::Popup), the delegate still looses focus and thus 
is deleted... Thanks so much though. If it matters, I'm using Qt5.0.1 on 
Linux.

Josh

 On 02/23/2013 04:40 PM, Joshua Grauman wrote:
 Hello all,
 
 I have a QTableWidget that uses a custom delegate. When I double click on
 a cell, the editor comes up fine. But then I want to be able to pull up a
 helper widget/window to enter data into the persistent editor. The problem
 is, when I show the new widget/window, the QTableWidget looses focus and
 the persistent editor is destroyed. Does anyone have any idea of how to
 bring up a new widget/window while still editing the persistent editor
 delegate? Thanks.
 

 Josh:

 I had the same problem, but don't remember which, of the hundreds
 of lines of code I have had to write to trick Qt into giving me the
 behavior I want, was added to fix this problem.

 I think it was this (on the custom editor window) :

Qt::WindowFlags flags = windowFlags();
flags |= Qt::Dialog;
// flags |= Qt::Popup;
setWindowFlags(flags);
setWindowModality(Qt::ApplicationModal);

 Bill

 Josh
 ___
 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] Globally Converting QTapAndHoldGesture to Mouse Double Click

2013-02-22 Thread Joshua Grauman
That is a good thought, but I don't think that is the problem. I have a 
double click event handler on one of my widgets, and it's not even getting 
called. I would think that sending a double click event would cause the 
double click event handler to be called, so that's why I think that 
somehow I'm not sending the double click event correctly or somehow it 
isn't getting to the appropriate widget... Thanks.

Josh

 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

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


[Interest] Globally Converting QTapAndHoldGesture to Mouse Double Click

2013-02-21 Thread Joshua Grauman
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] QToolBar in Qt5 under Mac

2013-02-13 Thread Joshua Grauman
Thanks! Any idea if there are plans to add QToolBar back in for Mac?

Josh

 On Feb 12, 2013, at 9:08 PM, Joshua Grauman jnf...@grauman.com wrote:

 Qt could not resolve function qimagetocgimage from
 QGuiApplication::platformNativeInterface()-nativeResourceFunctionForIntegration()
 Segmentation fault: 11


 Looks like your qtmacextras and qtbase are out of sync.

 To fix it you can either locally revert 04622d69 in qtmacextras or update 
 QtBase to have 784b9655. (use newest stable)

 Morten
 ___
 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] Porting to Qt5/macx-xcode Mountain Lion

2013-01-24 Thread Joshua Grauman
 Hi,

 On Thu, Jan 24, 2013 at 7:08 AM, Joshua Grauman jnf...@grauman.com wrote:
 First a disclaimer, I know very little about Mac OS specifics. I only have
 a Mac to build my app for it.

 I am porting two apps to Mac OS Mountain Lion and Qt5. The apps have run
 fine on quite a few of the Qt4 series versions in Windows/Linux/Mac (Snow
 Leopard). They both run fine in Qt5/Linux. I just installed the latest
 Mountain Lion version with latest XCode. I've gotten them to compile by
 running:

 qmake -spec macx-xcode project.pro
 xcodebuild

 But two completely different programs both segfault on a simple line:

QFile file(file);
if(!file.open(QIODevice::ReadOnly | QIODevice::Text))
  exit(0);
QTextStream in(file);
in.setCodec(UTF-8);
while(!in.atEnd())
{
  QString line = in.readLine(); //segfault here
...

 At first I thought it was new Mac OS sandboxing stupidity limiting my file
 acces, but I have have been able to get that line to run fine in a minimal
 example (so I'm guessing that's not it, but I'm still not positive).

 Where's your backtrace? A backtrace should be able to tell you at
 least where exactly it segfaults (possibly within Qt code). And make
 sure you have Qt built with debugging symbols, otherwise the backtrace
 won't be very useful.

 Andreas


Sorry, you're right that I should have included this for completeness.

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   QtCore  0x000100d6bb0b 
QTextStreamPrivate::fillReadBuffer(long long) + 299
1   QtCore  0x000100d6c26f 
QTextStreamPrivate::scan(QChar const**, int*, int, 
QTextStreamPrivate::TokenDelimiter) + 143
2   QtCore  0x000100d6d5dd 
QTextStream::readLine(long long) + 125
3   com.yourcompany.trainer 0x00015e59 main + 2825
4   com.yourcompany.trainer 0x000128d4 start + 52

Thanks for any help!

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


Re: [Interest] Porting to Qt5/macx-xcode Mountain Lion

2013-01-24 Thread Joshua Grauman
I'm not sure I did this correctly, but it did give some more information. 
Now I can see that it is segfaulting on QTextCodec::toUnicode(), which 
incidentally, also segfaults in another program I have. So I think I can 
trace most (all?) my segfaults to this function. Thanks for any more help!

Josh

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x
0x00010195730e in QTextCodec::toUnicode ()
(gdb) backtrace
#0  0x00010195730e in QTextCodec::toUnicode ()
#1  0x000101a2bea7 in QTextStreamPrivate::fillReadBuffer ()
#2  0x000101a2cb1a in QTextStreamPrivate::scan ()
#3  0x000101a2e5aa in QTextStream::readLine ()
#4  0x00015e6d in main ()

 On quinta-feira, 24 de janeiro de 2013 19.36.02, Andreas Pakulat wrote:
 Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
 0   QtCore  0x000100d6bb0b
 QTextStreamPrivate::fillReadBuffer(long long) + 299
 1   QtCore  0x000100d6c26f
 QTextStreamPrivate::scan(QChar const**, int*, int,
 QTextStreamPrivate::TokenDelimiter) + 143
 2   QtCore  0x000100d6d5dd
 QTextStream::readLine(long long) + 125
 3   com.yourcompany.trainer 0x00015e59 main + 2825
 4   com.yourcompany.trainer 0x000128d4 start + 52

 Hmm, unfortunately thats not enough, its apparently crashing within
 fillReadBuffer, but the line is not available. Presumably this is
 because you didn't configure Qt with -debug and hence only minimal
 debug information are available. So re-configuring and rebuilding Qt
 would most probably give a more helpful information.

 That's because it's an xcode / Mac OS X backtrace.

 Please give us a gdb backtrace, of the application when launched with
 DYLD_IMAGE_SUFFIX=_debug. That should select the debugging version of QtCore.


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


Re: [Interest] Porting to Qt5/macx-xcode Mountain Lion

2013-01-24 Thread Joshua Grauman
Ok, I think I've found the root problem. QTextCodec::codecByName(UTF-8) 
is returning 0. It's a static function, so I'm lost as to why this would 
be. I didn't compile my own Qt, just downloaded the main Qt5.0.0-clang SDK 
from the qt-project website and installed. This is what is causing the 
segfault in QTextStream::readLine(). Any idea what could be causing 
codecByName not to find UTF-8? Thanks!

Josh

 I'm not sure I did this correctly, but it did give some more information.
 Now I can see that it is segfaulting on QTextCodec::toUnicode(), which
 incidentally, also segfaults in another program I have. So I think I can
 trace most (all?) my segfaults to this function. Thanks for any more help!

 Josh

 Program received signal EXC_BAD_ACCESS, Could not access memory.
 Reason: KERN_INVALID_ADDRESS at address: 0x
 0x00010195730e in QTextCodec::toUnicode ()
 (gdb) backtrace
 #0  0x00010195730e in QTextCodec::toUnicode ()
 #1  0x000101a2bea7 in QTextStreamPrivate::fillReadBuffer ()
 #2  0x000101a2cb1a in QTextStreamPrivate::scan ()
 #3  0x000101a2e5aa in QTextStream::readLine ()
 #4  0x00015e6d in main ()

 On quinta-feira, 24 de janeiro de 2013 19.36.02, Andreas Pakulat wrote:
 Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
 0   QtCore  0x000100d6bb0b
 QTextStreamPrivate::fillReadBuffer(long long) + 299
 1   QtCore  0x000100d6c26f
 QTextStreamPrivate::scan(QChar const**, int*, int,
 QTextStreamPrivate::TokenDelimiter) + 143
 2   QtCore  0x000100d6d5dd
 QTextStream::readLine(long long) + 125
 3   com.yourcompany.trainer 0x00015e59 main + 2825
 4   com.yourcompany.trainer 0x000128d4 start + 52

 Hmm, unfortunately thats not enough, its apparently crashing within
 fillReadBuffer, but the line is not available. Presumably this is
 because you didn't configure Qt with -debug and hence only minimal
 debug information are available. So re-configuring and rebuilding Qt
 would most probably give a more helpful information.

 That's because it's an xcode / Mac OS X backtrace.

 Please give us a gdb backtrace, of the application when launched with
 DYLD_IMAGE_SUFFIX=_debug. That should select the debugging version of QtCore.


 ___
 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] Porting to Qt5/macx-xcode Mountain Lion

2013-01-24 Thread Joshua Grauman
Sorry for all the emails, but I finally tracked it down. 
QTextCodec::codecForName(UTF-8) is returning 0 because I call it before 
QApplication is initialized. I'm not sure if this is expected behavior or 
not. In any case, on the other platforms it's not a problem.

But where there is definitely a bug in Qt is that 
QTextCodec::codecForName(UTF-8) caches the results, even when it returns 
0. So my early call of QTextCodec::codecForName(UTF-8) gets a 0 cached 
for UTF-8, which then later causes QTextStream::readLine() to crash when 
it calls QTextCodec::codecForName(UTF-8). So looking at the Qt code, an 
extra condition should be added to make sure null pointers aren't cached 
in the QTextCodec::codecForName() function. Thanks!

Josh



 Ok, I think I've found the root problem. QTextCodec::codecByName(UTF-8)
 is returning 0. It's a static function, so I'm lost as to why this would
 be. I didn't compile my own Qt, just downloaded the main Qt5.0.0-clang SDK
 from the qt-project website and installed. This is what is causing the
 segfault in QTextStream::readLine(). Any idea what could be causing
 codecByName not to find UTF-8? Thanks!

 Josh

 I'm not sure I did this correctly, but it did give some more information.
 Now I can see that it is segfaulting on QTextCodec::toUnicode(), which
 incidentally, also segfaults in another program I have. So I think I can
 trace most (all?) my segfaults to this function. Thanks for any more help!

 Josh

 Program received signal EXC_BAD_ACCESS, Could not access memory.
 Reason: KERN_INVALID_ADDRESS at address: 0x
 0x00010195730e in QTextCodec::toUnicode ()
 (gdb) backtrace
 #0  0x00010195730e in QTextCodec::toUnicode ()
 #1  0x000101a2bea7 in QTextStreamPrivate::fillReadBuffer ()
 #2  0x000101a2cb1a in QTextStreamPrivate::scan ()
 #3  0x000101a2e5aa in QTextStream::readLine ()
 #4  0x00015e6d in main ()

 On quinta-feira, 24 de janeiro de 2013 19.36.02, Andreas Pakulat wrote:
 Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
 0   QtCore  0x000100d6bb0b
 QTextStreamPrivate::fillReadBuffer(long long) + 299
 1   QtCore  0x000100d6c26f
 QTextStreamPrivate::scan(QChar const**, int*, int,
 QTextStreamPrivate::TokenDelimiter) + 143
 2   QtCore  0x000100d6d5dd
 QTextStream::readLine(long long) + 125
 3   com.yourcompany.trainer 0x00015e59 main + 2825
 4   com.yourcompany.trainer 0x000128d4 start + 52

 Hmm, unfortunately thats not enough, its apparently crashing within
 fillReadBuffer, but the line is not available. Presumably this is
 because you didn't configure Qt with -debug and hence only minimal
 debug information are available. So re-configuring and rebuilding Qt
 would most probably give a more helpful information.

 That's because it's an xcode / Mac OS X backtrace.

 Please give us a gdb backtrace, of the application when launched with
 DYLD_IMAGE_SUFFIX=_debug. That should select the debugging version of 
 QtCore.


 ___
 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] Qt Installer Framework

2013-01-24 Thread Joshua Grauman

Hi,

I just found out about the Qt Installer Framework and so downloaded and 
compiled it. On linking, I see it is trying to link to QFSFileEngine, 
which isn't in Qt5. Is a Qt5 version of qif planned? Does anyone have it 
working in Qt5? Thanks!


Josh



24.01.2013, × 19:36, Karsten Heimrich karsten.heimr...@digia.com ÎÁÐÉÓÁÌ(Á):


Hi Ivan,

On 24.01.2013 14:33, é×ÁÎ ëÏÍÉÓÓÁÒÏ× wrote:

Thank you for reviewing patches. I have 2 more questions. Is it possible to 
remove the dir i want to install app to? I found RemoveTargetDir variable, but 
setting it from config.xml makes no effect. Also i can't find code that remove 
the dir:)


What do you mean with target dir? I guess the question goes into the direction 
of an already existing directory?


Yes, i mean when i try to install in an existing directory (which contains 
previous installation). The problem is that i have one plugin renamed and when 
i simply install into that dir, old file is not rewritten/deleted and i get 2 
copies of same plugin. I want to remove all contents of the directory i install 
to before writing new files. Is that possible?
Yes, i can remove that file manually using script, but it's not the best idea 
as i think.




And second questoin - i want to install my app into the C:/Program Files folder, however, 
in 64bit system that folder is named Program Files (x86) for 32bit app. Is it possible somehow to use 
system variables (qgetenv?) in an xml script, so i could write something like 
TargetDir@Program Files@/myinstall/TargetDir ? I see code that searches in registry, 
but not in system variables...


If not already there, add to your root component should an installscript.qs. 
Inside there, specify a constructor like this:

// constructor
function Component()
{
var programFiles = installer.environmentVariable(ProgramFiles);
if (programFiles != )
installer.setValue(TargetDir, programFiles + /foo);
}

I've tried this here and it sets the TargetDir variable to either C:\Program Files or 
C:\Program Files (x86). Please note that by default spaces are not allowed inside the target path, you can 
overwrite the behavior by setting AllowSpaceInPathtrue/AllowSpaceInPath in your config.xml. See also: 
http://doc-snapshot.qt-project.org/qtifw-1.2/ifw-globalconfig.html#summary-of-configuration-settings


Thank you, I'll try this trick tomorrow.



-- Karsten



é×ÁÎ ëÏÍÉÓÓÁÒÏ×

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


Re: [Interest] Porting to Qt5/macx-xcode Mountain Lion

2013-01-24 Thread Joshua Grauman

 On quinta-feira, 24 de janeiro de 2013 14.51.24, Joshua Grauman wrote:
 Sorry for all the emails, but I finally tracked it down.
 QTextCodec::codecForName(UTF-8) is returning 0 because I call it before
 QApplication is initialized. I'm not sure if this is expected behavior or
 not. In any case, on the other platforms it's not a problem.

 It's definitely a bug. Please remember that most Qt API is not supported 
 before
 the QCoreApplication object is initialized, so this bug will have a low
 priority of fixing.

That's fine. It was an easy work-around once I figured out what was 
causing it. But it's nice to be able to track something all the way down 
to ground to be sure what was going on rather than just fiddling with 
things until it works!

Josh


 But where there is definitely a bug in Qt is that
 QTextCodec::codecForName(UTF-8) caches the results, even when it returns
 0. So my early call of QTextCodec::codecForName(UTF-8) gets a 0 cached
 for UTF-8, which then later causes QTextStream::readLine() to crash when
 it calls QTextCodec::codecForName(UTF-8). So looking at the Qt code, an
 extra condition should be added to make sure null pointers aren't cached
 in the QTextCodec::codecForName() function. Thanks!

 Indeed. The ICU-based codec system has a cache.

 However, at first glance, I don't see anything that would cause the lookup to
 fail before QCoreApplication.


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


Re: [Interest] Porting to Qt5/macx-xcode Mountain Lion

2013-01-24 Thread Joshua Grauman
So looking at qtextcodec.cpp, there is quite a bit of conditionally 
compiled code. For example. if QT_USE_ICU is defined, 
QTextCodec::codecForName() calls QIcuCodec::codecForNameUnlocked(name) 
instead of looking it up itself, and the setup() function won't call 
(void)new QUtf8Codec; Presummably ICU would deal with that then, but maybe 
ICU only gets instantiated when QCoreApplication is called (or the other 
way around). But without being able to see what defines were on when 
Qt/Mac was compiled, that's going to be a tough one to track down. But my 
best guess would be to look at if QT_USE_ICU was defined in 
Linux/Mac/Windows when compiling the SDKs and maybe that would effect when 
QUtf8Codec gets instantiated...

Josh


 Ok, got it. That makes way more sense. Sorry for being slow. I'll take a
 look and let you know if I can find any more information.

 Josh

 On quinta-feira, 24 de janeiro de 2013 16.20.37, Joshua Grauman wrote:
 I'm not sure I completely understand your question, but I'll give it a
 shot. I had a global variable as follows (bad style, I know). It seems
 pointless I know, but it's because I also have other custom
 implementations of QTextCodec that get instantiated right next to it, so I
 just put them all together.

 QTextCodec *Ecodec = QTextCodec::codecForName(UTF-8);

 So since this was a global variable, it gets called before
 QCoreApplication, and I'm assuming that's why it returns 0. Does that
 help?

 No, because you had already told me that :-)

 I know it returns 0. Your hypothesis is that it returns 0 because it was
 called before QCoreApplication was initialised, which you've been able to
 prove to be the case. But I looked at the code and, at first glance, there 
 was
 nothing to indicate why that would be the behaviour.

 What I want to know is why that behaviour is so. Where, in the code inside 
 Qt,
 does it make a decision that gets it a null, instead of the proper codec?


 ___
 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] Porting to Qt5/macx-xcode Mountain Lion

2013-01-23 Thread Joshua Grauman
Hello all,

First a disclaimer, I know very little about Mac OS specifics. I only have 
a Mac to build my app for it.

I am porting two apps to Mac OS Mountain Lion and Qt5. The apps have run 
fine on quite a few of the Qt4 series versions in Windows/Linux/Mac (Snow 
Leopard). They both run fine in Qt5/Linux. I just installed the latest 
Mountain Lion version with latest XCode. I've gotten them to compile by 
running:

qmake -spec macx-xcode project.pro
xcodebuild

But two completely different programs both segfault on a simple line:

   QFile file(file);
   if(!file.open(QIODevice::ReadOnly | QIODevice::Text))
 exit(0);
   QTextStream in(file);
   in.setCodec(UTF-8);
   while(!in.atEnd())
   {
 QString line = in.readLine(); //segfault here
   ...

At first I thought it was new Mac OS sandboxing stupidity limiting my file 
acces, but I have have been able to get that line to run fine in a minimal 
example (so I'm guessing that's not it, but I'm still not positive). I'm 
wondering now if there is some sort of mismatch between xcode/clang 
version used to compile Qt5 and the version I'm using to compile my apps 
(maybe mine is too new?). Running otool -L on the Qt5 libs and my program 
shows they were compiled for different versions of libstdc++ 
(compatibility version 7.0.0 for both, but current version 52.0.0 for Qt5 
and 56.0.0 for my program). Could that cause a segfault in the readLine() 
function?

Does anyone one have any other ideas of what I would need to do to get my 
programs to run properly under the latest Mountain Lion / XCode and the 
standard Qt5 for Mac libs? Basically I'm asking if I'm missing something 
obvious in terms of library/compile versions or steps to port an app to 
Qt5 under Mac. Other than what I did to port my app to Qt5 under Linux, 
all I did was run qmake and xcodebuild to build it on Mac, and I don't 
know if there is something else I'm supposed to do.

Another related question. Is Qt5 going forward always going to use clang 
for Mac OSX, or should I also expect to see Qt5 prebuilt for gcc on Mac at 
some point as well?

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


Re: [Interest] Notes on porting exercise to Qt 5

2013-01-23 Thread Joshua Grauman
I'll add one more odd note about porting to Qt 5. I found that Qt::UniteClip 
is no longer an option in Qt5 as used in:
painter.setClipRect(rect, Qt::UniteClip);

I find this is a weird option to get rid of as Qt::IntersectClip is still 
there. Why one and not the other...

Josh

 On sexta-feira, 11 de janeiro de 2013 08.31.08, Jaco Naude wrote:
 Hi

 Some notes of my experience porting to the final release of Qt 5. I already
 ported to the beta a while back, but the following are new issues
 experienced with the final release. Maybe someone else also finds it useful.

 1) QString::toAscii() depreciated.

 The Qt5 documentation says that QString::toAscii() is depreciated, and
 indeed calls to this functions against Qt 5 gives errors. However this is
 not listed on http://qt-project.org/doc/qt-5.0/qtdoc/sourcebreaks.html.

 I'll update the docs.

 2) The documentation for
 QDesktopServiceshttp://qt-project.org/doc/qt-5.0/qtgui/qdesktopservices.htm
 l still
 contains documentation for the StandardLocation enum which was moved to
 QStandardPaths in Qt5.

 The enum still exists there. It's just deprecated.


 Thanks for the report!

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


[Interest] Enabling Harfbuzz on Mac

2012-02-22 Thread Joshua Grauman
Hello all,

According to this page, it is now possible to enable Harfbuzz on Mac by setting 
an environment variable:
https://bugreports.qt-project.org/browse/QTBUG-17728

However, unless I'm missing something I haven't been able to enable 
Harfbuzz on Mac. I'm using Qt 4.8, which according to the sources should 
have this feature enabled. It should be as simple as setting the 
environment variable: QT_ENABLE_HARFBUZZ which I have done. However, after 
doing this, my text output still looks drastically different on Mac than 
on Windows/Linux. I am using a TTF font by the way. Am I correct that if I 
am using Harfbuzz on Mac my text should be pixel perfect with 
Windows/Linux (with maybe the exception of subpixel aliasing). My outputs 
are drastically different. The text sizes are many pixels different, even 
with the same font and same font size. Most importantly, there are still 
some rendering bugs on Mac which aren't on Windows/Linux which leads me to 
believe I haven't enabled Harfbuzz properly. I used the following code 
which is pulled straight from the Qt sources and the environment variable 
seems set properly: QByteArray v = qgetenv(QT_ENABLE_HARFBUZZ); So does 
anyone have any ideas on what I am missing? Why would the text output 
still be different on Mac?

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