Re: [Interest] Update widget geometry BEFORE window shown

2024-05-27 Thread Tony Rietwyk

Hi Dave,

I have had a similar issue at various times, especially in Qt4, but not 
as much in Qt5 & 6.  A few places still had problems when adjusting 
after creating or deleting widgets, or switching pages in an embedded 
page control.  This is the routine I use:


void activateLayoutsRecursive(QWidget *w)
{
    if (w)
    {
    // Depth first traversal.
    for (auto k : w->children())
    {
        if (auto z = qobject_cast(k))
            activateLayoutsRecursive( z );
    }

    if (w->layout())
    {
        w->layout()->invalidate();
        w->layout()->activate();
        //qCDebug(lc) << w->objectName() << 
w->layout()->totalMinimumSize();

    }
    }
}

I hope that helps!

Tony

On 27/05/2024 4:01 pm, David M. Cotter wrote:

Does ANY ONE have any ideas on this?? Pretty please??

-dave


On May 24, 2024, at 12:14 PM, David M. Cotter  wrote:

I’ve tried everything I can think of. The ONLY one that works the way 
I NEED is the first one, but that one flashes the window on the screen


#if 1
qWidgetP->show();
qWidgetP->hide();
QtLetTimersFire(0);
#endif

#if 0
QLayout*layoutP(qWidgetP->layout());

layoutP->update();
layoutP->activate();
QtLetTimersFire(0);
#endif

#if 0
for (auto* childP: qWidgetP->findChildren()) {
childP->updateGeometry();
}

qWidgetP->updateGeometry();
QtLetTimersFire(0);
#endif

#if 0
qWidgetP->setAttribute(Qt::WA_DontShowOnScreen, true);
qWidgetP->show();
// qWidgetP->layout()->invalidate();
// qWidgetP->layout()->update();
// qWidgetP->layout()->activate();
qWidgetP->hide();
qWidgetP->setAttribute(Qt::WA_DontShowOnScreen, false);
QtLetTimersFire(0);
#endif

#if 0
qWidgetP->setAttribute(Qt::WA_DontShowOnScreen, true);
qWidgetP->show();

qWidgetP->layout()->invalidate();
qWidgetP->layout()->update();
qWidgetP->layout()->activate();

for (auto* childP: qWidgetP->findChildren()) {
childP->updateGeometry();
}

qWidgetP->updateGeometry();

qWidgetP->hide();
qWidgetP->setAttribute(Qt::WA_DontShowOnScreen, false);
QtLetTimersFire(0);
#endif___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] Is there a way of having a global signal spy?

2023-12-20 Thread Tony Rietwyk

Hi Nuno,

To see what is happening in the whole application, you can use KDAB's 
GammaRay:


https://www.kdab.com/development-resources/qt-tools/gammaray/

I've never used it, so I don't know whether or how much it slows down 
the app while monitoring.


Regards,

Tony


On 20/12/2023 8:11 pm, Nuno Santos wrote:

Hi,

Sometimes I feel myself in the dark regarding signals being emitted.

Sometimes because of refactors and things that change, signals are being 
emitted and we are not aware of.

Is there any way of easily making all the emitted signals being traced on the 
console when a Qt app is running?

Has anyone ever crossed this specific problem/need?

Thanks!

Regards,

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

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


Re: [Interest] Item / Views: QLabel delegate

2023-12-01 Thread Tony Rietwyk

Hi Laslo,

In my delegate, I use a QTextDocument instead and I also override sizeHint:

void MessagesDelegate::paint(
QPainter *painter,
const QStyleOptionViewItem ,
const QModelIndex ) const
{
 QStyleOptionViewItem optionV4 = option;
 initStyleOption(, index);
 QStyle *style = optionV4.widget ? optionV4.widget->style() : 
QApplication::style();
 QRect textRect = style->subElementRect(QStyle::SE_ItemViewItemText, );
 // Draw the item without any text:
 style->drawPrimitive(QStyle::PE_PanelItemViewItem, , painter, 
optionV4.widget);
 _doc.setTextWidth(-1);
 _doc.setHtml("This is a test message");
 QAbstractTextDocumentLayout::PaintContext ctx;
 ctx.palette = optionV4.palette;
 // TODO:  Change ctx.palette according to cell being disabled and/or selected.
 painter->save();
 painter->translate(textRect.topLeft());
 painter->setClipRect(textRect.translated(-textRect.topLeft()));
 doc.documentLayout()->draw(painter, ctx);
 painter->restore();
}


QSize MessagesDelegate::sizeHint(
const QStyleOptionViewItem& option,
const QModelIndex& index) const
{
 _doc.setTextWidth(-1);
 _doc.setHtml("This is a test message");
 return QSize(_doc.idealWidth(), _doc.size().height());
}

Sorry I can't release the full code as it does lots of other things like 
icon decoration role, clicking on links in the HTML, etc.


Hope that helps,

Tony


On 2/12/2023 12:06 am, Laszlo Papp wrote:

Hi everyone,

I am not able to render a custom widget, like a QLabel in a QTreeView 
cell with a custom delegate. The delegate code is this:


*Header*
#ifndef MESSAGESDELEGATE_H
#define MESSAGESDELEGATE_H

#include 
#include 

class MessagesDelegate : public QStyledItemDelegate
{
 Q_OBJECT

public:
 explicit MessagesDelegate(QObject* parent = nullptr);

 void paint(QPainter *painter, const QStyleOptionViewItem , 
const QModelIndex ) const override;


private:
 mutable QLabel _label;
};

#endif

*Source*
#include "MessagesDelegate.h"

#include 

MessagesDelegate::MessagesDelegate(QObject* parent)
 : QStyledItemDelegate(parent)
{
}

void MessagesDelegate::paint(QPainter* painter,
               const QStyleOptionViewItem& option,
               const QModelIndex& index) const
{
 _label.setText("This is a test message");
 _label.render(painter);
}

and then:

_messageDelegate = new MessagesDelegate(this);
_messageTreeView->setItemDelegateForColumn(MessageColumn, 
_messageDelegate);


But I am seeing my QTreeView cell empty instead of seeing the above 
"This a test message" in there. Do you know what I may be doing wrong?


I took this idea from here:
https://groups.google.com/g/python_inside_maya/c/FXB_V0llUpY/m/mpJOQkyJCgAJ

Thank you in advance.

Kind regards,
László

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


Re: [Interest] qmake: set CFBundleDisplayName?

2023-05-31 Thread Tony Rietwyk

Hi,

In our iOS builds we use our own .plist files.  They are included in the 
.pro file by


    QMAKE_INFO_PLIST = $$_PRO_FILE_PWD_/Info.plist

The .plist file looks like:


"http://www.apple.com/DTDs/PropertyList-1.0.dtd;>



    CFBundleDevelopmentRegion
    en
    CFBundleDisplayName
    Cadences
    CFBundleDisplayName~ipad
    Cadences
    CFBundleExecutable
    ${EXECUTABLE_NAME}
    CFBundleIdentifier
    com.companyname.ios.a-cad
    CFBundleInfoDictionaryVersion
    6.0
    CFBundleName
    ${PRODUCT_NAME}
    CFBundlePackageType
    APPL
    CFBundleShortVersionString
    0.1
    CFBundleSignature
    
    CFBundleVersion
    20150312
    ... lots and lots of other crap




Hope that helps!

Tony

On 31/05/2023 10:29 pm, Alexander Dyagilev wrote:

Hello,

Is there a way to set this value from within qmake using some of its 
built-in variables?


By default, qmake generates Info.plist with the following content:

CFBundleDisplayName
${PRODUCT_NAME}


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

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


Re: [Interest] Continued past failed assertions with MSVC

2023-05-08 Thread Tony Rietwyk

Hi Thiago,

I rarely use Ignore - usually, I would temporarily comment out the 
assertion and rerun.


What I find much more annoying is that after clicking Retry and 
debugging the environment, I cannot then ignore the error - rewind the 
stack back to the asserting routine and continue from the next statement 
- I use Visual Studio.  A quick google shows some workarounds, I'll 
investigate those.


Tony

On 9/05/2023 2:25 am, Thiago Macieira wrote:

When a Qt application fails a Q_ASSERT and was compiled against a debug-mode
QtCore, with MSVC, it shows a debug dialog with three options: Abort, Retry,
Ignore. It looks like
https://www.google.com/search?q=_CrtDbgReport+dialog

This is a horrible dialogue that harkens back to the DOS days.

But the big problem is that "Ignore" button: it allows the application to
ignore this condition and continue executing. I suppose people use it for
debugging past failed assertions to see what else is going on.

So the question is: does anyone use this particular feature? Would you suffer
terribly if we removed it? This would bring MSVC in line with the other
compilers.


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

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


Re: [Interest] The touch screen events are block after deleteLater function

2023-02-16 Thread Tony Rietwyk

Hi Gianmarco,


Maybe if you listen for button click events - they should work 
regardless of mouse or touch.  What platform are you running on?



Regards,

Tony


On 16/02/2023 11:09 pm, Axel Spoerl via Interest wrote:

Hi Gianmarco,

if I understand the code correctly, you depend on signals being fired 
from a push button. The Home class doesn't look like a button, so it 
will never receive mouse button events.

That's probably why the qDebug() doesn't see any.

You need to intercept the events of that push button:
Unless already enabled, please set the Qt::WA_AcceptTouchEvents 
attribute on the button. Install an event filter on the button and 
qDebug() all incoming events.
Watch out for TouchBegin, TouchUpdate, TouchEnd. You could intercept 
and interpret those and emit an own signal, if the press & release 
signals don't get fired correctly.


Brgds
Axel

*Von:* g.scarpe...@u-tech.it 
*Gesendet:* Donnerstag, 16. Februar 2023 12:41
*An:* Axel Spoerl 
*Cc:* interest@qt-project.org 
*Betreff:* Re:AW: [Interest] The touch screen events are block after 
deleteLater function


Hi Axel ,

Using the qDebug I see and the code below, QEvent::MouseButtonPress 
never fires if I press the touch:


--Home.cpp-

bool Home::event ( QEvent * curEvent ) {

  if ( curEvent -> type ( ) == QEvent::MouseButtonPress ) {
qDebug ( ) << "Click!"  ;
 }

return QWidget::event ( curEvent ) ;
}


Home.h--
...
private:
bool event ( QEvent * curEvent ) override ;
...

I also tried using the setFocus and update function. But I don't solve 
the problem. In this way:


void Home::closeAvvioLavaggio()
{
disconnect(window,::closeLavaggio,this,::closeAvvioLavaggio);
 window->deleteLater();
 window = nullptr ;

|this->setFocus ( ) ; this->update ( ) ; |

}

do you have any suggestion?

Thanks,

Gianmarco




*-*-*-*-*-*-*-*-*-*-*-*-*
Dot. Gianmarco Scarpelli
Microtech Srl
Via Mameli, 94
53043 Chiusi (Si)
http://www.microtechsrl.net
Tel +39 0578 294621
Fax +39 0578 1900218

Attenzione: Le informazioni contenute in questo messaggio di posta 
elettronica sono private e confidenziali, riservate solo 
all'attenzione del destinatario. Qualora doveste ricevere questo 
messaggio per errore, Vi notifichiamo con la presente che ogni 
diffusione, riproduzione, distribuzione o utilizzo del presente 
messaggio è altamente proibita. Siete pregati di informare il mittente 
con un messaggio di risposta e cancellare immediatamente il presente 
messaggio ed il suo eventuale contenuto, senza copiarlo o aprirlo.

*
This e-mail and any file transmitted with it, which may contain 
confidential and/or privileged material, is legally privileged and 
intended solely for the recipient. Access to this e-mail by anyone 
else, use it for any purpose, store, copy, disclose the contents to 
any other person totally or partially is strictly prohibited and 
illegal. If you are not the intended recipient(s), please do not read 
this e-mail, delete this message and any attachments from your system 
and contact the sender by reply e-mail or by telephone.

*


From"Axel Spoerl" axel.spo...@qt.io
To"interest@qt-project.org" 
interest@qt-project.org,"g.scarpe...@u-tech.it" g.scarpe...@u-tech.it

Cc
DateThu, 16 Feb 2023 10:39:35 +
SubjectAW: [Interest] The touch screen events are block after 
deleteLater function


It's difficult to analyze the problem without seeing the whole code, 
especially the graphics layout.
The deleteLater-instruction will cause the object to be deleted, when 
events are being processed.
The error could be another widget acquiring focus or overlaying the 
button, before the button is released.
When the finger is released, the touch gesture can no longer be 
attributed to the button and the release signal is not emitted.
That would explain why it happens on the touch screen, but not with 
the mouse.

A possible workaround is to connect to the button's pressed signal.

In order to find the issue, you have to implement a helper, listening 
to all relevant signals and qDebug() the result.
The screen freeze could be caused by accessing a deleted object, but 
also by a blocking infinite loop. Throwing qDebugs in the code will 
shed more light on this.


*Von:* Interest  im Auftrag von 
g.scarpe...@u-tech.it 

*Gesendet:* Donnerstag, 16. Februar 2023 10:53
*An:* interest@qt-project.org 
*Betreff:* [Interest] The touch screen events are block after 
deleteLater function


Hi,

I am development my application with the qt 5.15 (c++ code) .The my 
application is implement using objects are child of the QWidget class. 
Every time that I open a child class connect the closing signal at the 
slot to parent class to delete the object 

Re: [Interest] MSVC not-the-latest: are you using it? why?

2023-01-23 Thread Tony Rietwyk

Hi Thiago,

The team I'm working with have been keeping up with the latest VS 
version - mainly for the security fixes and new C++11/17/20 features 
available in Qt 5.15.  But VS2022 introduced changes to the enum 
handling last year, which has made Intellisense useless for them - 
especially class enum's.  Made worse since we had previously changed 
many of our enum's to class ones.  :O(


I doubt that would stop anyone upgrading, but maybe there are other 
non-compiler reasons for staying with older versions of dev environments.


Regards,

Tony

On 23/01/2023 3:18 am, Thiago Macieira wrote:

In this case, MSVC 2019, which is still supported.

I'm trying to understand why people don't upgrade their Visual Studios. In the
past, they used to use different and binary-incompatible VC runtimes, so large
projects often needed to stick to a single version because of different teams
needing to otherwise have a flag day.

But that hasn't been the case since MSVC 2015. So, are you still sticking to
older MSVC releases years after there's a new one? Why?

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

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


Re: [Interest] QRegularExpression for replace

2022-12-01 Thread Tony Rietwyk

On 2/12/2022 6:43 am, Scott Bloom wrote:


Im looking for a way using QRE to do something like the following

auto regEx = QRegularExpression( “(?.*)” );

if ( regEx.match( string ) )

    auto newString = regEx.replace( string, “${name}” );

Using the standard set of regex subsitutions

Is this something anyone is looking at? Or is there a solution outthere?

Scott


Hi Scott,

I have no idea what 'the standard set of regex substitutions' are, but 
have you seen QString replace(const QRegularExpression , const 
QString ) ?


It supports capturing groups in the after string as well.

Hope that helps,

Tony

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


Re: [Interest] Qt Sql BLOB data converting

2022-11-28 Thread Tony Rietwyk

Hi Yauheni,

You don't say which type of database you are using?  There may be issues 
with the database client library altering the blob to UTF8.  Though I 
would expect the python code using the same client to have the same 
problem.


Assuming that QVariant has the byte array unaltered, then 
QVariant.toByteArray().length() should give 34.  Using qstrlen, suggests 
that you are using QVariant.toString instead.  To print the hex you 
should just use QVariant.toByteArray().toHex().


Hope that helps,

Tony


On 28/11/2022 6:46 pm, Yauheni Pervenenka via Interest wrote:

Hello, community
I have faced with issue that qvariant using qstrlen for getting data 
size, but sometimes it returns wrong size especially for BLOB data(if 
there are some special symbols), are there any way to get data correct?


Note:
Database value 34, python returns correct data size, but 
qvariant::toByteArray returns 52


Python data and Database data in hex(size 
68): 763130492d46ab4c9c7bb0e9789b29c3ab1e4723dea6c8e5d2f9b266a275e1fbe4a6


Qt data in hex(size 104):
763130492d46c2ab4cc29c7bc2b0efbfbd78c29b29c3ab1e4723dea6efbfbdefbfbdefbfbdefbfbd66c2a275efbfbdefbfbdc4a6

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

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


Re: [Interest] Use SQLite math functions (-DSQLITE_ENABLE_MATH_FUNCTIONS) like sin and cos?

2022-10-24 Thread Tony Rietwyk

Hi Oliver,

Can't answer your broader question, but I suspect the reason you are 
seeing "No query Unable to fetch row" - error code: "" is because you 
are not checking for an error after the prepare. Hopefully, you will 
then the expected 'no such function' error and can act on it accordingly.


Regards,

Tony

On 25/10/2022 4:58 am, Till Oliver Knoll wrote:


Dear all,

What is the least complicated way to enable the math functions that 
come with SQLite, when it is compiled with the 
-DSQLITE_ENABLE_MATH_FUNCTIONS switch?


My empirical experiments with the binary Qt 5.15.2 (open source) 
release (but also some tests with the lastest Qt 6.4 binary release, 
for either Windows or macOS) suggest that the SQLite plugin that ships 
with Qt does not enable those "built in mathematical functions", as 
described here:


https://www.sqlite.org/lang_mathfunc.html

So do I:

  * Recompile the Qt SQLite plugin, with the desired
-DSQLITE_ENABLE_MATH_FUNCTIONS flag?
  o Disadvantages (?):
  + Need to download Qt source code
  + Probably complicates the build process... (I have "build
actions" on github.com that currently "only" need to
install the binary Qt distribution)
  + Feels a bit "overkill"
  * Try to get the "SQLite DB handle" and add my own sin(), cos() and
power() functions?
  o As described here:
https://forum.qt.io/topic/71210/sqlite-user-define-functions/3
  + Essentially "QSqlDatabase::driver->handle()", some voodoo
casting and using sqlite3_create_function()
  o Advantages:
  + Probably can be achieved using the "stock" SQLite plugin
that ships with Qt, "programatically"
  o Disadvantages (?):
  + Still need to get hold of some SQLite header (for
sqlite_create_function etc.)
  + Fragile? What if the header mismatches (in the future)
with the shipped Qt SQLite plugin?
  # Feels "hacky"...
  * Any other "trick" to add those "math extensions" to an existing Qt
SQLite plugin?

The second option seems more attractive than the first, but 
nevertheless a bit "fragile" (and I have to add functions that would 
essentially "already be in SQLite" (if enabled & compiled)), so feels 
like "re-inventing the wheel"...


Some more details: specifically I am trying to execute a query like:

*select power(l.latitude - 48.0, 2) + power((l.longitude - 8.0) * 
cos(radians( 48.0 )), 2) dist from   location l;*


(Eventually I want to find locations given by their latitude and 
longitude that are within a certain distance of my given location: 
https://jonisalonen.com/2014/computing-distance-between-coordinates-can-be-simple-and-fast/)


However when compiled into my Qt 5.15.2 application with some current 
"test code" like:.


QSqlQueryquery1;
query1.setForwardOnly(true);
query1.prepare(
"selectpower(l.latitude-48.0,2)+power((l.longitude-8.0)*cos(radians(48.0)),2)dist"
"from location l;"
);
constboolsuccess=query1.exec();
 if(success){
...
}else{
qDebug()<<"SQL error:"

Re: [Interest] QColumnView and QTreeView using same model

2022-05-04 Thread Tony Rietwyk

On 4/05/2022 11:43 pm, Michael Jackson wrote:

...
Now on to figure out how to display checkboxes next to each item. I've tried:

Qt::ItemFlags ImportDataStructureModel::flags(const QModelIndex& index) const
{
   if(!index.isValid())
   {
 return {};
   }
   return Qt::ItemIsUserCheckable | Qt::ItemIsSelectable | 
QAbstractItemModel::flags(index);
}

Which does not seem to show anything. I'll probably have to create a custom 
delegate.
--
Mike Jackson


Hi Mike,

If you return flag ItemIsUserCheckable in your model, then you must also 
return a valid variant with Qt::CheckState for data(Qt::CheckStateRole) 
- it won't just assume Qt::Unchecked.


Ditto with the item widgets - besides item->setFlags, you need to call 
item->setCheckState as well.


Tony

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


Re: [Interest] [External]Re: How to get QtConcurrent to do what I want?

2022-01-30 Thread Tony Rietwyk
That's looks OK.  Why does the tile object creation take so long?  Is 
all of the image handling in tile::process, or does tile constructor 
extract from the original?



Regards, Tony


On 31/01/2022 11:59 am, Murphy, Sean wrote:
Thanks for the response, but I'm not following your suggestion - or at 
least I'm not seeing how it's different than what I'm doing? Maybe a 
little pseudocode will help. Here's what I'm currently doing:


Tile class:
private:
QPointmPos;
intmSize;

tile::tile(QPointpos,intsize):
mPos(pos),
mSize(size)
{
// assigns this tile an mSize x mSize square
// from the original image starting at mPos
// pixel location in the original image
}

voidtile::process()
{
// does the work on the assigned subset
}
TileManager:
private:
QVector> mTiles;

processTile(QSharedPointer& t)
{
t->process();
}

tileManager::setup(QSize tileGrid, int tileSize)
{
//generateeachtilewithitsassignment
for(inti=0;it(newtile(
QPoint(j*tileSize,i*tileSize),
tileSize));
mTiles.append(t);
}
}
QtConcurrent::map(mTiles,processTile);
}

So I think I'm already doing what you're saying? Where I'm paying the 
penalty is that the allocation of each tile is happening in one thread 
and I'd like to see if I can thread out the object creation. But I 
don't see how to simultaneously thread out the tile objection creation 
AND correctly assign the tile its location since as far as I can tell, 
when QtConcurrent executes tileManager's processTile function in 
parallel there's nothing I can poll inside tileManager::processTile() 
that allows me to know WHICH step I'm at.


Or am I misunderstanding what you're saying?

The best thing I can come up with is that maybe I could change the 
type of my mTiles vector to be a QVector> but then I'd still 
need to loop through nested for-loop to populate all the QPoint items 
in the vector I want to pass to QtConcurrent::map(). I have tried that 
yet to see if generating thousands of QPoint objects is faster than 
generating the same number of tiles, but I can test that out.


Sean

*From:* Interest  on behalf of Tony 
Rietwyk 

*Sent:* Sunday, January 30, 2022 7:19 PM
*To:* interest@qt-project.org 
*Subject:* [External]Re: [Interest] How to get QtConcurrent to do what 
I want?
CAUTION: This email originated from outside of the organization. Do 
not click links or open attachments unless you recognize the sender 
and know the content is safe.


Hi Sean,


Can you use the position of the tile as a unique key?  Then the 
manager only needs to calculate each tile's position in the original 
image.  Each tile extracts the bits, processes and notifies the result 
with its position.



Regards, Tony



On 31/01/2022 10:06 am, Murphy, Sean wrote:
I'm hitting a design issue with the way I'm using the QtConcurrent 
module to do some image processing, and I'm wondering if someone can 
give some pointers?


At a high level, the software needs to do some processing on every 
pixel of an image. The processing can mostly be done in parallel, so 
I've created the following:


 1. Tile class - responsible for doing the processing on a small
subset of the original image
 1. Has a constructor that takes a Position and Size. From those
parameters, the Tile knows what subset of the original image
it is going to process
 2. Has a process() function which will do the work on those
assigned pixels
 2. TileManager class - responsible for managing the Tile objects
 1. Contains a for-loop that creates each Tile object, assigns it
a unique Position, and adds it to the QVector vector
 2. Has a processTile(Tile& t) function which calls t.process()
to tell a given Tile to begin its work
 3. Calls QtConcurrent::map(tiles, processTile) to process each tile

So far this works well, but as I was timing different parts of the 
codebase, I discovered that a large portion of the time is spent 
allocating the QVector vector (step 2a above) before I get to 
the concurrent processing call. The reason why is obvious to me - I 
need to ensure that each tile is created with a unique assignment and 
as far as I can see, that need to happen in a single thread? If I 
could instead pass off the Tile creation to the parallel processing 
step, I might be able to improve the overall performance, but I don't 
see a way around it within the QtConcurrent framework.


How can I go about creating Tile objects in parallel AND ensure that 
each of them gets a unique Position assignment? I could easily move 
the Tile allocation into processTile(), but if I do that, I don't see 
a way make the unique position assignment since I don't see how a 
given call to processTile() would know where it is in the overall 
parallelization sequence to determine what Position to assign to the 
Tile it creates. If I were using something like CUDA, I could use 
things like blockIdx and threadIdx to do that, bu

Re: [Interest] How to get QtConcurrent to do what I want?

2022-01-30 Thread Tony Rietwyk

Hi Sean,


Can you use the position of the tile as a unique key?  Then the manager 
only needs to calculate each tile's position in the original image.  
Each tile extracts the bits, processes and notifies the result with its 
position.



Regards, Tony



On 31/01/2022 10:06 am, Murphy, Sean wrote:
I'm hitting a design issue with the way I'm using the QtConcurrent 
module to do some image processing, and I'm wondering if someone can 
give some pointers?


At a high level, the software needs to do some processing on every 
pixel of an image. The processing can mostly be done in parallel, so 
I've created the following:


 1. Tile class - responsible for doing the processing on a small
subset of the original image
 1. Has a constructor that takes a Position and Size. From those
parameters, the Tile knows what subset of the original image
it is going to process
 2. Has a process() function which will do the work on those
assigned pixels
 2. TileManager class - responsible for managing the Tile objects
 1. Contains a for-loop that creates each Tile object, assigns it
a unique Position, and adds it to the QVector vector
 2. Has a processTile(Tile& t) function which calls t.process() to
tell a given Tile to begin its work
 3. Calls QtConcurrent::map(tiles, processTile) to process each tile

So far this works well, but as I was timing different parts of the 
codebase, I discovered that a large portion of the time is spent 
allocating the QVector vector (step 2a above) before I get to 
the concurrent processing call. The reason why is obvious to me - I 
need to ensure that each tile is created with a unique assignment and 
as far as I can see, that need to happen in a single thread? If I 
could instead pass off the Tile creation to the parallel processing 
step, I might be able to improve the overall performance, but I don't 
see a way around it within the QtConcurrent framework.


How can I go about creating Tile objects in parallel AND ensure that 
each of them gets a unique Position assignment? I could easily move 
the Tile allocation into processTile(), but if I do that, I don't see 
a way make the unique position assignment since I don't see how a 
given call to processTile() would know where it is in the overall 
parallelization sequence to determine what Position to assign to the 
Tile it creates. If I were using something like CUDA, I could use 
things like blockIdx and threadIdx to do that, but as far as I can 
see, those concepts don't exist (or at least aren't exposed) in 
QtConcurrent.


Any thoughts?

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


Re: [Interest] QSyntaxHighlighter change QTextBlockFormat

2022-01-04 Thread Tony Rietwyk


On 5/01/2022 3:30 pm, Joshua Grauman wrote:

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


Hi Josh,

Just a wild guess, but do these syntax changes occur after loading the 
document, or while editing?  If the latter, maybe the syntax changes 
could be grouped with the triggering command as a single undo/redo action?


Regards, Tony

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


Re: [Interest] PySide2 : Adding widget to a QVBoxLayout in a QScrollArea

2021-07-12 Thread Tony Rietwyk

Hi Nicholas,

QScrollArea manages a single widget.  It provides a default, or you can 
override it - look at the docs.


So in this case, you could apply the layout and pushbutton to 
scroll.widget, instead of scroll itself.


Also take out the self.setLayout(vbox) - the layout can only belong to 
one widget.


Hope that helps,

Tony


On 13/07/2021 2:30 pm, Nicholas Yue wrote:

Hi,

  The QPushButton I added does not stay inside of a scroll area, where 
am I calling the API wrongly ?


import sys
from PySide2 import QtWidgets, QtCore
class Example(QtWidgets.QWidget):
def __init__(self):
super(Example, self).__init__()
self.initUI()
def initUI(self):
scroll = QtWidgets.QScrollArea()
scroll.setWidgetResizable(True)
vbox = QtWidgets.QVBoxLayout()
vbox.setAlignment(QtCore.Qt.AlignTop)
scroll.setLayout(vbox)
vbox.addStretch(1)
for index in range(20):
vbox.addWidget(QtWidgets.QPushButton('button {}'.format(index)))
self.setLayout(vbox)
self.setGeometry(300, 300, 300, 150)
self.setWindowTitle('Buttons')
self.show()
def main():
app = QtWidgets.QApplication(sys.argv)
ex = Example()
ex.show()
sys.exit(app.exec_())
if __name__ == '__main__':
main()

Cheers
--
Nicholas Yue
https://www.linkedin.com/in/nicholasyue/ 



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


Re: [Interest] PySide2 : QHBoxLayout content sizing

2021-07-11 Thread Tony Rietwyk
Doh!   I assumed ui_inputs and ui_outputs were QWidgets, not QLayouts - 
sorry!


Try setStretch or setStretchFactor instead - unfortunately, my Qt 
Designer is broken, so I can't check those myself.


Regards, Tony


On 12/07/2021 12:26 pm, Nicholas Yue wrote:

Hi Tony,

  Are you able to share the method/API call to set the minimum width ?

Cheers

On Sun, 11 Jul 2021 at 18:12, Tony Rietwyk <mailto:t...@rightsoft.com.au>> wrote:


Hi Nicholas,

You could set a minimum width on them based on the expected width
- don't forget to set it back to 0 when you add their true content.

Regards, Tony


On 12/07/2021 7:27 am, Nicholas Yue wrote:

Hi,

I have a horizontal layout, self.viewHorizontalLayout

I am adding the following items

        # Inputs/View/Outputs panel
        self.ui_inputs = QtWidgets.QVBoxLayout()
        self.ui_inputs.addStretch(1)
        # inputs.addWidget(QPushButton('inputs'))
self.viewHorizontalLayout.addLayout(self.ui_inputs)

        self.ui_scene = QtWidgets.QGraphicsScene() # Object
lifetime critical
        self.ui_view = QtWidgets.QGraphicsView(self.ui_scene)
self.viewHorizontalLayout.addWidget(self.ui_view)

        self.ui_outputs = QtWidgets.QVBoxLayout()
        # outputs.addWidget(QPushButton('outputs'))
self.viewHorizontalLayout.addLayout(self.ui_outputs)

As self.ui_inputs and self.ui_outputs are initially empty,
self.ui_view occupies the entire self.viewHorizontalLayout

Is there some hints/size/stretch I can set on self.ui_inputs and
self.ui_outputs so that later on, when I do add items to them, it
does not pop in size to accommodate the additional content ?

Cheers
-- 
Nicholas Yue

https://www.linkedin.com/in/nicholasyue/
<https://www.linkedin.com/in/nicholasyue/>

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

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



--
Nicholas Yue
https://www.linkedin.com/in/nicholasyue/ 
<https://www.linkedin.com/in/nicholasyue/>
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] PySide2 : QHBoxLayout content sizing

2021-07-11 Thread Tony Rietwyk

Hi Nicholas,

You could set a minimum width on them based on the expected width - 
don't forget to set it back to 0 when you add their true content.


Regards, Tony


On 12/07/2021 7:27 am, Nicholas Yue wrote:

Hi,

I have a horizontal layout, self.viewHorizontalLayout

I am adding the following items

        # Inputs/View/Outputs panel
        self.ui_inputs = QtWidgets.QVBoxLayout()
        self.ui_inputs.addStretch(1)
        # inputs.addWidget(QPushButton('inputs'))
        self.viewHorizontalLayout.addLayout(self.ui_inputs)

        self.ui_scene = QtWidgets.QGraphicsScene() # Object lifetime 
critical

        self.ui_view = QtWidgets.QGraphicsView(self.ui_scene)
        self.viewHorizontalLayout.addWidget(self.ui_view)

        self.ui_outputs = QtWidgets.QVBoxLayout()
        # outputs.addWidget(QPushButton('outputs'))
        self.viewHorizontalLayout.addLayout(self.ui_outputs)

As self.ui_inputs and self.ui_outputs are initially empty, 
self.ui_view occupies the entire self.viewHorizontalLayout


Is there some hints/size/stretch I can set on self.ui_inputs and 
self.ui_outputs so that later on, when I do add items to them, it does 
not pop in size to accommodate the additional content ?


Cheers
--
Nicholas Yue
https://www.linkedin.com/in/nicholasyue/ 



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


Re: [Interest] Qt Creator can't find all usages of a symbol sometimes

2021-06-10 Thread Tony Rietwyk

Hi Alexander,

What file is the Warning at the top referring to?  My bet would be 
utils.h or utils.cpp?  Does this problem ever occur for this large 
project without the warning appearing?


If the problem tends to occur with files that have just been saved, then 
maybe the code scanner can't access the files because you have a virus 
scanner active on the project folder that kicks in shortly after any 
files are saved?


Regards, Tony


On 10/06/2021 7:47 pm, Alexander Dyagilev wrote:


Hello,

Why can it be? This happens in large projects.

An example:

Utils.cpp is opened. I right clicked PersistentStatsJsonName and chose 
"Find References to Symbol under cursor". Here you can see that it has 
failed to find the reference in this opened utils.cpp file.



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


Re: [Interest] QML MenuBar : works with PySide2 but not c++ ?

2021-06-02 Thread Tony Rietwyk

Hi Nicholas,

The short answer is because your C++ is doing completely different 
things to the python code.  :O)


I'm not sure about using QML.  Have you included the qml file as a 
resource correctly to access via qrc:?  You aren't checking the result 
of the engine.load.  Also, why is the lambda exiting the application 
when the objectCreated matches the url?


Have run the Qt QML examples?  How is your C++ code different to those?

Hope that helps, Tony


On 3/06/2021 11:33 am, Nicholas Yue wrote:

Hi,

  I am learning about QML.

  I would like to find out why the PySide2 loading of the QML file 
results in a visible window but the C++ one does not. The compiled 
application runs but no window is displayed.


MenuBar.qml
===
import QtQuick 2.4
import QtQuick.Controls 2.13

ApplicationWindow {
    visible: true
    width: 720
    height: 480
    title: "simple window"

    menuBar: MenuBar{
        Menu{
            title: "Menu1"
        }

        Menu{
            title: "Menu2"
        }

        Menu{
            title: ""
        }
    }
}

main.cpp

#include 
#include 

int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);

    QGuiApplication app(argc, argv);

    QQmlApplicationEngine engine;
    const QUrl url(QStringLiteral("qrc:/MenuBar.qml"));
    QObject::connect(, ::objectCreated,
                     , [url](QObject *obj, const QUrl ) {
        if (!obj && url == objUrl)
            QCoreApplication::exit(-1);
    }, Qt::QueuedConnection);
    engine.load(url);

    return app.exec();
}

main.py
===
import sys
from PySide2 import QtCore, QtGui, QtQml

if __name__ == '__main__':

QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling)
    app = QtGui.QGuiApplication(sys.argv)

    engine = QtQml.QQmlApplicationEngine()

    url = QtCore.QUrl.fromLocalFile('MenuBar.qml')
    engine.load(url)
    if not engine.rootObjects():
        sys.exit(-1)

    sys.exit(app.exec_())

--
Nicholas Yue
Graphics - Arnold, Alembic, RenderMan, OpenGL, HDF5
Custom Dev - C++ porting, OSX, Linux, Windows
http://au.linkedin.com/in/nicholasyue 

https://vimeo.com/channels/naiadtools 



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


Re: [Interest] Can't JSON.stringify an object in QML

2021-06-01 Thread Tony Rietwyk

HI Jason,

I'm pretty sure this is NOT valid JSON:

  {"that": "other": {} }

Either the value and comma for "that" is missing, or "other": {} should 
be encapsulated as an object in braces as the value of "that".


Regards, Tony


On 2/06/2021 12:29 am, Jason H wrote:

Some JSON serialisers replace that with null nowadays.

I guess you could write some code to test whether it’s cyclical
and at which elements it recurses. If you feel not up to it,
write back and I’ll try (ECMAscript is not a language I feel
comfortable in either but I think I could manage).


Well, if it were cyclical (I really don't think it is),  I would expect that 
the line:
return QJsonDocument::fromVariant(v).toJson(QJsonDocument::Compact);

Would never return. However it does, and it gives me the exact string I would 
expect.
So I'm still at a loss there.


The object does contain an empty object, could that be it? For example:
{"that": "other": {} }




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

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


Re: [Interest] Call retranslateUi() from UI generated/loaded directly from *.ui

2021-05-01 Thread Tony Rietwyk

Did you try "loader.setTranslationEnabled(true);" before loader.load?

HTH, Tony

On 1/05/2021 10:43 am, Nicholas Yue wrote:
I tried enabling setLanguageChangeEnabled(true) but I don't see my 
label updating, do I have to write some handler for that event and go 
through to update each widget text ? Apologies, I am new to translation.


```
#include"MainWindow.h"
#include
#include
#include
#include
#include
#include
MainWindow::MainWindow(QWidget*parent)
:QMainWindow(parent)
{
QUiLoaderloader;
QFilefile(":/designer/mainwindow.ui");
file.open(QFile::ReadOnly);
QWidget*widget=loader.load(,parent);
loader.setTranslationEnabled(true);
file.close();
setCentralWidget(widget);
ui_checkBox=findChild("checkBox");
QObject::connect(ui_checkBox,SIGNAL(clicked()),this,SLOT(doCheckBox()));
}
voidMainWindow::doCheckBox(){
qDebug()<<"doCheckBox()called="isChecked())
{
QStringlangFile=QString(":/language/.qm/mlc_de.qm");
QTranslatortranslator;
if(translator.load(langFile)){
qDebug()<<"DESuccessful";
boolinstalled=qApp->installTranslator();
if(installed){
qDebug()<<"DEinstalled";
}
}
else
{
qDebug()<<"DEUnsuccessful";
}
}
else
{
QStringlangFile=QString(":/language/.qm/mlc_C.qm");
QTranslatortranslator;
if(translator.load(langFile)){
qDebug()<<"CSuccessful";
boolinstalled=qApp->installTranslator();
if(installed){
qDebug()<<"Cinstalled";
}
}
else
{
qDebug()<<"CUnsuccessful";
}
}
}
```

On Thu, 29 Apr 2021 at 23:39, Friedemann Kleint 
mailto:friedemann.kle...@qt.io>> wrote:


Hi,

 >  I am developing an application where I am generating the UI via
loading the *.ui rather than using uic to generate the
source/header file.

 >  I need to call retranslateUi to update my translation but most
documentation talks about a generated method by uic

It should automatically react to language change events, see:

https://doc.qt.io/qt-6/quiloader.html#setLanguageChangeEnabled


Regards, Friedemann

-- 


Friedemann Kleint
The Qt Company GmbH

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




--
Nicholas Yue
Graphics - Arnold, Alembic, RenderMan, OpenGL, HDF5
Custom Dev - C++ porting, OSX, Linux, Windows
http://au.linkedin.com/in/nicholasyue 

https://vimeo.com/channels/naiadtools 



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


Re: [Interest] Embedding language translation as resource

2021-04-26 Thread Tony Rietwyk
Further to Robert's reply, you need to change the file name in both the 
qrc file and in main.cpp.


Regards, Tony

On 27/04/2021 3:31 pm, Robert Hairgrove wrote:


You need to load the ".qm" file which is the binary generated by 
running lrelease, not the ".ts" file.


In addition to your "hello_la.qm" file, you might want to load Qt's 
"qtbase_la.qm" file (if there is one) which contains translations for 
most of the built-in GUI elements.


HTH, Bob

--

On 27.04.21 07:06, Nicholas Yue wrote:

Hi,

  I am trying to embed translation file as a resource but when I run 
the compiled program, it fails to load the translation


ERROR: Translation failure to load

main.cpp
***
#include 
#include 
#include 
#include 

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    QString appDir = QCoreApplication::applicationDirPath();
    QTranslator translator;
    QString translationDir = appDir + "/translation";
    // if (translator.load("hellotr_la",translationDir)) {
if (translator.load(":/language/hellotr_la.ts")) {
    app.installTranslator();
    } else {
    std::cerr << "ERROR: Translation failure to load" << std::endl;
    }

    QPushButton hello(QPushButton::tr("Hello world!"));
    hello.resize(100, 30);

    hello.show();
    return app.exec();
}

hellotr_lang.qrc
**


    hellotr_la.ts



hellotr_la.ts
*




    QPushButton
    
        
        Hello world!
        
    



hellotr,pro

SOURCES      = main.cpp
TRANSLATIONS = hellotr_la.ts

target.path = $$[QT_INSTALL_EXAMPLES]/linguist/hellotr
INSTALLS += target

QT += widgets

RESOURCES += hellotr_lang.qrc


Cheers
--
Nicholas Yue
Graphics - Arnold, Alembic, RenderMan, OpenGL, HDF5
Custom Dev - C++ porting, OSX, Linux, Windows
http://au.linkedin.com/in/nicholasyue 

https://vimeo.com/channels/naiadtools 



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


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


Re: [Interest] SQLite: mystic bug: No query Unable to fetch row error

2021-01-14 Thread Tony Rietwyk

Hi,

I haven't used SQLite, but I'm wondering if when the UuidByteArray 
starts with a zero byte, then maybe nothing gets written for the value?  
1 in 16 of the generated UUID's could have this, which roughly matches 
your 4% failures.


Is a BLOB field binary or text?  Does a binary blob with embedded zeroes 
always get fully written?  Maybe using base64 encoding would work better?


Hope that helps,


On 15/01/2021 2:18 am, Alexander Dyagilev wrote:

Hello,

Each instance of our app is supposed to have an unique id (UUID).

At every start, it check if it has assigned one, and if not - 
generates it and saves it to the SQLite database.


We've found, that 4% of ours users has empty UUIDs.

We've added some diagnostic reporting info and found, that this is 
caused by SQLite database not being able to write generated UUID to it.


QSqlQuery::exec returns false and its last error returns this error 
"No query Unable to fetch row error".


How can this be? I could not find any problems working with the 
database in our code.


We do it so:

1. Make sure the table exists:

"CREATE TABLE IF NOT EXISTS miscData (Name TEXT, Value BLOB, PRIMARY 
KEY (Name))"


2. Write value to the table:

QSqlQuery query(m_db);
query.prepare("REPLACE INTO miscData (Name, Value) VALUES (:Name, 
:Value)");

query.bindValue(":Name", "UUID");
query.bindValue(":Value", UuidByteArray);

if (!query.exec())
{
 // here we're getting this error
}

What are the possible reasons of this error?


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

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


Re: [Interest] Debugging a double dealloc

2020-09-23 Thread Tony Rietwyk

Hi Ben,

There may indeed be an issue with fonts being tied to having at least 
one window present, which causes you grief when you delete the main window.


Have you tried the suggestion from your other thread to just hide the 
main window instead?


Where is the tick font used?  Does your main menu that you want to 
persist without any windows use it?


Have you tried a cut-down app that creates a plain QMainWindow, a plain 
main menu, then destroys the main window to see if persisting the main 
menu is actually doable on Mac?


Regards, Tony

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


Re: [Interest] Three-file modules vs. moc

2020-08-27 Thread Tony Rietwyk

Hi Bernhard,

I use plain .pro and .pri files with qmake to Visual Studio projects.  
Moc has a feature that prevents the output files being treated as 
separate compiles - if it finds the include in the relevant module 
.cpp.  It works really well for us with thousands of modules.  I not 
sure how that work flow translates to Qt Creator.


If you add

#include 

as the second line in spinbox.cpp, and then run qmake or whatever the 
Creator equivalent is.  After that, the moc steps will run as normal, 
and then the compile of spinbox.cpp without a separate compile for 
moc_spinbox.cpp.


Hope that helps,

Tony


On 27/08/2020 5:40 am, Bernhard Lindner wrote:

Hi!

Currently I am facing a problem with a Qt Creator managed Qt 5 project.

The projects consists of a lot of modules and implements a special but useful 
file
concept. Each module has 3 files:
module.hpp - Public types, macros and declarations
module.inl - Template function definitions, constexpr and inline function 
definitions
module.cpp - All other definitions
module.cpp includes module.inl and module.inl includes module.hpp.

I added all .hpp file names to the .pro file using Qt Creator. All moc relevant 
.hpp files
are parsed fine by moc and a moc_module.cpp file is generated for each module 
as usual.
Unfortunately the moc_module.cpp files includes module.hpp only, since 
module.inl are
unknown to moc.
So all function definitions from moc_module.inl are unknown during compilation 
of
moc_module.cpp and I get undefined reference linker errors (e.g. for property 
related
setters called in the moc_module.cpp code).

Maybe I could use a lot of Q_MOC_RUN preprocessor conditions to work around but 
that would
pollute the code awfully.

How can I solve this problem on the moc side? Is there a way to tell moc via 
the .pro
project on a per-module basis to include module.inl instead of (or along with) 
module.inl
in moc_module.cpp?


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


Re: [Interest] breakpoints not resolving (again) (mac)

2020-07-27 Thread Tony Rietwyk

Hi dave,

You haven't said what IDE you are seeing these errors in?  If Qt 
Creator, maybe this link can help:


https://doc-snapshots.qt.io/qtcreator-4.0/creator-debugger-engines.html

The document suggests that Python is required now for LLDB and GDB.  
Maybe you have an old version of Python installed that is confusing the 
run-time.


Regards, Tony


On 27/07/2020 10:35 am, David M. Cotter wrote:
i note this is also in the debugger log on startup, don't know if it 
is related:


dNOTE: INFERIOR RUN OK - REPEATED.
eERROR: Lldb stderr: warning: 'QtCore' contains a debug script. To run 
this script in this debug session:
e command script import 
"/Users/davec/Developer/Qt/5.15.0/clang_64/lib/QtCore.framework.dSYM/Contents/Resources/DWARF/../Python/QtCore.py"

eTo run all discovered debug scripts in this session:
e settings set target.load-script-from-symbol-file true



On Jul 26, 2020, at 5:27 PM, David M. Cotter > wrote:


they always have a little hourglass in them (ie: pending)

i've tried all the usual suspects:

  * clean and rebuild project
  * update Qt to latest
  * try shadow vs. not shadow build
  * ensure .dSYM file is next to actual .app package
  * ensure i build "debug" version (with "-g" option)
  * ensure i'm RUNNING the debug version


when i go to insert a breakpoint the debugger log window says this:

*>TAKING OWNERSHIP OF BREAKPOINT 23*
*>63insertBreakpoint({"address":0,"command":"","condition":"","enabled":1,"expression":"","file":"/Users/davec/Developer/Qt/Examples/Qt-5.15.0/multimediawidgets/videographicsitem/main.cpp","function":"","id":"","ignorecount":0,"line":62,"modelid":23,"oneshot":0,"token":63,"type":1})*
*>(lldb) script 
theDumper.insertBreakpoint({"address":0,"command":"","condition":"","enabled":1,"expression":"","file":"/Users/davec/Developer/Qt/Examples/Qt-5.15.0/multimediawidgets/videographicsitem/main.cpp","function":"","id":"","ignorecount":0,"line":62,"modelid":23,"oneshot":0,"token":63,"type":1})*

*>@*
*>result={token="63",lldbid="5",valid="1",hitcount="0",threadid="0",oneshot="0",condition="",enabled="1",valid="1",ignorecount="0",locations=[]}@*
*>63^*
*>NO LOCATIONS (YET) FOR BP Type: 0 [enabled] [pending] Hit: 0 times *




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


Re: [Interest] temp disable any selection changing in TableView?

2020-07-22 Thread Tony Rietwyk

Hi dave,

The selection is normally handled by an internally allocated 
QSelectionModel, which maintains the current item separate from the 
selections.  You can replace the selection model if necessary.  In this 
case, you want the current item to change, but not the selections, 
depending on which column was clicked, or whatever other condition.  You 
may need to override the view and/or change the selection model to 
intercept the calls between them.  Then you modify the parameters to 
force them to only change the current.


Good luck!   ;O)


On 23/07/2020 12:32 am, David M. Cotter wrote:


my developer is reporting difficulty suppressing selection changes in a 
TableView, when attempting to edit an item.

is there a way to say "hey tableview, do NOT change the selection for a bit while i 
do something" ?

eg: one of my columns has a popup menu.

if i select row 5, then i want to click the popup in row 4, i do NOT want the 
selection to change. i want to change the popup in row 4 and leave row 5 
selected.

same if i want to edit text.

is this even possible?

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

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


Re: [Interest] Bug of broken headers for QQuick3DGeometry

2020-06-26 Thread Tony Rietwyk

Hi Joao,

Looking at the simplescene example, it has in the .pro file

qt += quick quick3d

whereas you only have

qt += quick

In the Qt documentation, I couldn't find anything saying what the .pro 
requirements for quick3d is!


Tony


On 26/06/2020 2:49 pm, joao morgado via Interest wrote:

Hi

I reported a bug about broken headers for QQuick3DGeometry, QQuick3D 
and QQuick3DObject, here:


https://bugreports.qt.io/browse/QTBUG-85263

I would like to try to fix this bug, but not sure where to start looking.
Somebody has any hints, advices here I should start ?

Cheers
Joao


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


Re: [Interest] How to get a column data from QTableWidget

2020-05-29 Thread Tony Rietwyk

Hi Ghobad,

item->tableWidget()->item(item->row(), my_intended_col_index)->data(role)

Regards, Tony

On 29/05/2020 10:35 pm, Ghobad Zarrinchian wrote:

Dear all,
I have a QTableWidget with some rows and columns in my application and 
I want to extract the data from a specific column when its row (item) 
is double clicked. I don't know which function can get me the data 
when having a pointer to the item. I use the slot function below and 
need some method like 'col' as used here. However, there is no such 
function.


voidMainWindow::on_tableWidget_itemDoubleClicked(QTableWidgetItem*item)
{
QString data = item->col(my_intended_col_index).toString(); // no such 
function

}

How should i modify the code above to work for me?
Thanks.

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


Re: [Interest] QTableView, QSqlRelationalTableModel and QDateTimeEdit and timezones

2020-04-30 Thread Tony Rietwyk

Hi Lisandro,

AFAIK that is a bug in the design of the Qt SQL api's.  There is no way 
to specify to QSqlField/QSqlResult that the date being read is UTC.  You 
have to read the QSqlQuery yourself, convert the QVariant to QDateTime, 
apply the time spec, then pass the value to the UI.


Maybe you can derive from QSqlRelationalTableModel and override the data 
method to set the time spec?


Regards, Tony


On 1/05/2020 5:04 am, Lisandro Damián Nicanor Pérez Meyer wrote:

Hi!

I have a database (PostgreSql) with a table that holds date/time in
UTC. I've read this table with the QSqlRelationalTableModel and show
the data with a QTableView and a QDateTimeEdit.

I would like both the QTableView and the QDateEdit to show the time in
local timezone, but I seem to be failing at this.

I have tried with
ui->admissionDateTimeEdit->setTimeSpec(Qt::OffsetFromUTC) and other
time specs both before and after setting the model without success
(there is a bug for that in [1])

Is there something else I am missing?

The actual code is in [2] but it's not minimal. If needed I'll try to
get a minimal example for this.

[1] 
[2] 


Thanks in advance!


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


Re: [Interest] Writing custom Qt Widgets is overly complicated

2020-04-29 Thread Tony Rietwyk
On 28 April 2020 at 12:05:54, Jonathan Purol (cont...@folling.de 
) wrote:


Yesterday however I put my hands on trying to implement my first 
custom widget.


The item in question is what I would describe as a "Tag Textfield".


[…]

The last approach seemed rather clever, and it worked pretty well. I 
could put widgets into the textfield and align them at the left. 
First I tried to do this manually, then I opted for an HBoxLayout.


Sorry, I don’t really have a solution for Qt Widgets. But is 
QHBoxLayout really the best pick there? I would go for a “flow” 
layout, like the QML ‘Flow’ positioner (but you’d have to make it 
yourself). In this way your tags can wrap correctly according to 
widget’s width.


In fact this is what I did in my QML Tag Edit widget 
(https://github.com/fferri/QtQuick-TagsEditItem) maybe this is the 
shoddy one you said you already found :-D


I didn’t put too much effort in it, and it has some minor issues, as 
it can be seen from the screenshot. But the implementation is very 
simple, so one can easily pick up from that and extend it. Maybe also 
fixing those positioning issues is a one-liner fix (if anyone wants to 
contribute a fix… PRs are welcome).


Maybe you can copy and adapt the implementation to Qt Widgets.

Cheers,

Federico Ferri


Hi Jonathon,

For some reason, I didn't receive your original post.

As a starting point, I agree with Federico and suggest using the flow 
layout given in the Qt Layout examples 
qthelp://org.qt-project.qtwidgets.5127/qtwidgets/qtwidgets-layouts-flowlayout-example.html 



Use a separate QLabel for each tag, and a single QLineEdit with 
clearButtonEnabled=true that is initially hidden.  In each label's 
onClick, hide the label and insert the edit with the same text 
immediately after it in the layout.  When the focus leaves the edit, if 
there is text in the edit, put the text back into the adjacent hidden 
label and show the label, otherwise delete the label.  Then hide the 
edit box.  Ensure there is always an empty label to click on at the end.


Regards, Tony


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


Re: [Interest] Fwd: External Application window title is missing in QWindow

2020-03-20 Thread Tony Rietwyk

Hi Sujan,

I had thought fromWinId was restricted to only hosting third-party 
window drawing libraries in your own process space, but it is more 
powerful than that.


setCentalWidget parents your external window within the QMainWindow.  
Maybe that tells Windows not to draw the top-level window frame, 
including the title bar and system menu.  I'm not clear what you mean 
about the app menu bar.


To workaround it, I would keep the reference returned by 
createWindowContainer without putting it in your layout, and place a 
dummy transparent widget in the central area instead.  You'll need to 
coordinate the size information and events between the external widget 
and the dummy widget - lookup sizeHint and resizeEvent.  Good luck!


Regards, Tony


On 20/03/2020 5:09 pm, Sujan Dasmahapatra wrote:

Dear Tony

Thanks for your answer. first of all I am not repeating the question 
here. It is still a single thread. I am sorry for that.


finally I am still stuck with it. If you or any one could help me I 
will highly appreciate it.


My code snippet as follows.

QWindow*window=newQWindow;//
window=QWindow::fromWinId((WId)id);
QWidget*widget=QWidget::createWindowContainer(window);
widget->show();

This shows me the external app, that I am launching using qprocess. when I am 
extracting the app, using FindWindow.
HWNDid=FindWindow(NULL,L"MyGL");

It is showing in the widget, but menubar is missing,. so the desired result is 
not what that I want. It's missing the header Name
and menu bar. Is there any othe way that I can achieve the full app window. I 
want to see the full app window into the widget
without missing any component. Let me know some one if any how we can achieve 
this in Qt.


regards
sujan


On Sat, 29 Feb 2020 at 15:25, Sujan Dasmahapatra 
mailto:yellowlemontree0...@gmail.com>> 
wrote:


Dear Tony

You're right, I am trying to access two separate apps, to be
launched in a single QTabwidget. but how does it matter, since
even if I launch in single Widget, it is still not coming. The
header title is being correctly used I am able to launch the app.
But the app's header and menu bar, are not being launched.


if(process_->waitForStarted(-1))

{

//0.002899170.28096-0.180618=343

HWNDid=FindWindow(0,L"App.exe");

if(!id)

return;

QTimert;

t.start(2500);

QWindow*window=QWindow::fromWinId((WId)id);

QWidget*widget=QWidget::createWindowContainer(window);

setCentralWidget(widget);

}

I am trying it on QMainWindow. And I think FindWindow itself is giving 
header text and menu less portion. So window and widget none

is getting it. Can you suggest me what can be done for this.

regards

sujan




    On Sat, 29 Feb 2020 at 07:53, Tony Rietwyk mailto:t...@rightsoft.com.au>> wrote:

Hi Sujan,

It's not clear to me why you want to use fromWinId? Do you
want two applications in separate processes to share the same
windows?  The title bar and menu are drawn by special win32
non-client events - but they may be suppressed, since the
window is now being hosted in your app.  With more
information, maybe someone can help you - don't just repeat
the same details in another post!

Regards, Tony


On 28/02/2020 11:13 pm, Sujan Dasmahapatra wrote:


Dear Friends,

My External Application Window title, is missing in my
QWindow.  I am trying to set this window on a Widget and
finally I am displaying this widget on QScrollBar. But I am
missing the Window title and menu bar from the app. Please
check the code snippet below.

QWindow* window = QWindow::fromWinId(id);
QWidget* widget = QWidget::createWindowContainer(window);
_gui->scrollArea->setWidget(widget);

With this snippet, I can see the app is launched, but it's
Title header text, is not opening.

Please advise me what is going wrong. I have to see the
window title and most importantly the menu bar as well.

regards
sujan


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

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

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


Re: [Interest] Fwd: External Application window title is missing in QWindow

2020-02-28 Thread Tony Rietwyk

Hi Sujan,

It's not clear to me why you want to use fromWinId?  Do you want two 
applications in separate processes to share the same windows? The title 
bar and menu are drawn by special win32 non-client events - but they may 
be suppressed, since the window is now being hosted in your app.  With 
more information, maybe someone can help you - don't just repeat the 
same details in another post!


Regards, Tony


On 28/02/2020 11:13 pm, Sujan Dasmahapatra wrote:


Dear Friends,

My External Application Window title, is missing in my QWindow.  I am 
trying to set this window on a Widget and finally I am displaying this 
widget on QScrollBar. But I am missing the Window title and menu bar 
from the app. Please check the code snippet below.


QWindow* window = QWindow::fromWinId(id);
QWidget* widget = QWidget::createWindowContainer(window);
_gui->scrollArea->setWidget(widget);

With this snippet, I can see the app is launched, but it's Title 
header text, is not opening.


Please advise me what is going wrong. I have to see the window title 
and most importantly the menu bar as well.


regards
sujan


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


Re: [Interest] Signal/Slot connection fails, even though QMetaObject::activate is called

2020-02-14 Thread Tony Rietwyk


On 15/02/2020 7:01 am, Matthew Woehlke wrote:

On 07/02/2020 19.10, Tony Rietwyk wrote:

Does it work if you don't pass 'this' as the third argument to connect?
I never use that particular overload of connect. I usually pass the
lambda as the third argument.

That scares me. The third argument is the context in which the slot
runs, i.e. the "receiver". If your lambda contains any state, not
passing a context risks the slot being called after whatever owns that
state has ceased to exist, which will likely lead to UB. (It also risks
the lambda running in the wrong thread.)

Basically, if your lambda has *any state at all*, you should *always*
pass a context. The context should be a QObject which owns that state
and whose thread can safely use the state.

The context should only be omitted if your lambda is stateless, and even
then I'd avoid doing so unless you really need to, or are making a
deliberate choice that no one should "own" the connection.


That's strange - I thought the whole point of the [=] in the lambda is 
to capture a shallow copy of the state required by the code within the 
lambda.  Whereas [&] copies references to the state variables.  Of 
course, whether these copies or references work in whatever thread when 
the code is actually executed is up to you to guarantee - via 
QSharedPointers or whatever.  I haven't used lambdas across threads - in 
those cases I've used the receiver/pointer-to-method overload.


The third parameter context solely determines which thread's event loop 
the lambda runs in.  In the shorter overload, I would assume that the 
context is simply the current thread object.  Both overloads have the 
following warning:


    "The connection will automatically disconnect if the sender or the 
context is destroyed. However, you should take care that any objects 
used within the functor are still alive when the signal is emitted."


In my experience, coding in particular ways "because it scares you" 
often leads to poor results.  A C++ lambda is basically a temporary 
object with the copied or referenced state, and a call operator()(...) { 
/* lambda code */ }.


Regards, Tony


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


Re: [Interest] Signal/Slot connection fails, even though QMetaObject::activate is called

2020-02-07 Thread Tony Rietwyk

Hi,

Does it work if you don't pass 'this' as the third argument to connect?  
I never use that particular overload of connect. I usually pass the 
lambda as the third argument.


Hope that helps, Tony


On 8/02/2020 10:03 am, Scott Bloom wrote:

Are you sure the function is getting called (via a break point)?



-Original Message-
From: Interest [mailto:interest-boun...@qt-project.org] On Behalf Of Jonathan 
Purol
Sent: Friday, February 7, 2020 2:44 PM
To: Qt Project 
Subject: [Interest] Signal/Slot connection fails, even though 
QMetaObject::activate is called

Hello everyone,

I have a QMainWindow subclass called `text_editor` with a function `save` which 
looks as follows:
```cpp
void text_editor::save() {

      _textbox->document()->setModified(false);
      _textbox->setFocus();

      emit saved();

}
```

I now connect to that slot in another class like this:
```cpp
_information_editor = new text_editor{this};

connect(
      _information_editor,
      _editor::saved,
      this,
      [=]() {
      std::cout << "hello\n";
      }
);

```

I have verified that the signal is emitted, in fact, the method generated by 
the moc:
```cpp
// SIGNAL 0
void text_editor::saved()
{
      QMetaObject::activate(this, , 0, nullptr); } ``` is 
definitely called (verified with gdb and some other debugging shenenigans).
In addition, the connection object returned by `connect` is valid, as verified 
by its implicit bool-cast operator.
However, "hello" is never printed. I suspected this could be because 
`text_editor` inherits from `QMainWindow` and could have a different thread affinity, so 
I tried the following things:

1. Move the editor to the same thread as the object which establishes the 
connection 2. Use a QueuedConnection 3. Connect to the slot from WITHIN the 
text editor itself, making sure that we are 100% on the same slot

and none of them worked.
Just for clarification, the print of "hello" is only an example, so even if 
there was some issue with that, I would have detected it, the actual code is of course 
different.

I'm really out of luck here, and would appreciate any help.

Sincerely,
Folling

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

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


Re: [Interest] QNetworkDiskCache + QNetworkRequest::PreferNetwork = always cache

2020-01-13 Thread Tony Rietwyk

Hi Alexander,

The wording for PreferNetwork in the help is a bit ambiguous:

    "default value; load from the network if the cached entry is older 
than the network entry."


It reads as if a OPTION query has been done, giving "the network entry" 
- but maybe it just relies on the cached page's cache headers.  Are you 
sure that the server is setting an expires timestamp, or max-age correctly?


Hope that helps,

Tony


On 14/01/2020 12:24 pm, Alexander Dyagilev wrote:

Well, yes, but this eliminates the whole idea :)

On 1/14/2020 1:54 AM, Thiago Macieira wrote:

On Sunday, 12 January 2020 22:34:24 PST Alexander Dyagilev wrote:

Hello,

I've created a bug report: https://bugreports.qt.io/browse/QTBUG-81318

Is there some workaround?...

AlwaysNetwork


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

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


Re: [Interest] Qt Android 9 bug?

2019-11-26 Thread Tony Rietwyk

Hi Alex,

That Armv7 trace looks really weird - the QThread destructor is calling 
the derived QDaemonThread one?


Regards, Tony


On 26/11/2019 1:02 pm, Alexander Dyagilev wrote:


Hello,

We're getting strange crashes in our Google Console. All of them are 
from Android 9.


We use Qt 5.12.5.

Armv7 reports are all as the following:

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** pid: 
0, tid: 0 >>> org.freedownloadmanager.fdm <<< backtrace:

#00 pc 0001cf76 /system/lib/libc.so (abort+58)
#01 pc 000834dd 
/data/app/org.freedownloadmanager.fdm--OVRDQQmEuXHU_lSXwlfxA==/lib/arm/libQt5Core.so
#02 pc 00083bc7 
/data/app/org.freedownloadmanager.fdm--OVRDQQmEuXHU_lSXwlfxA==/lib/arm/libQt5Core.so 
(QMessageLogger::fatal(char const*, ...) const+58)
#03 pc 000868df 
/data/app/org.freedownloadmanager.fdm--OVRDQQmEuXHU_lSXwlfxA==/lib/arm/libQt5Core.so 
(QDaemonThread::~QDaemonThread()+174)
#04 pc 00086a8d 
/data/app/org.freedownloadmanager.fdm--OVRDQQmEuXHU_lSXwlfxA==/lib/arm/libQt5Core.so 
(QThread::~QThread()+4)


Armv8 reports are even less informative:

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** pid: 
0, tid: 0 >>> org.freedownloadmanager.fdm <<< backtrace:

#00 pc 00022988 /system/lib64/libc.so (abort+116)
#01 pc 000ad994 
/data/app/org.freedownloadmanager.fdm-oQm9cQzA_x7sVQd81KmLCw==/lib/arm64/libQt5Core.so
#02 pc 000af078 
/data/app/org.freedownloadmanager.fdm-oQm9cQzA_x7sVQd81KmLCw==/lib/arm64/libQt5Core.so 
(QMessageLogger::fatal(char const*, ...) const+208)


The only qFatal call in the destructor is see in QThread source 
(https://code.woboq.org/qt5/qtbase/src/corelib/thread/qthread.cpp.html) 
is this:


qFatal("QThread: Destroyed while thread is still running");

But I'm pretty sure we call QThread::quit and QThread::wait before 
deleting all QThread objects we create. So it should not be possible 
that the problem resides on our side.


Any suggestions? Can this be the bug of qt android core? We can't 
reproduce it and this bug is NOT happening under Windows platform...




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


Re: [Interest] Qt on windows?

2019-11-11 Thread Tony Rietwyk

Hi Jason,

Seeing the double equals at the end, I tried decoding that string as 
base64, which gives "rxstation_ui.zip"


Are you sure that directory is actually a folder, or just appears to be 
a folder due to the way Windows Explorer works?


Regards, Tony


On 12/11/2019 10:05 am, Jason H wrote:

Thanks for the tip. Moving it out of that cnhzdGF0aW9uX3VpLnppcA== directory 
made it happy.
I wonder if = is messing it up, even though it is quoted?
Total line is 130 chars. Does CMD have a 128 char limit? I thought that was 
raised to 32k?





Sent: Monday, November 11, 2019 at 5:07 PM
From: "Thiago Macieira" 
To: interest@qt-project.org
Subject: Re: [Interest] Qt on windows?

On Monday, 11 November 2019 13:01:32 PST Jason H wrote:

15:58:59: Starting: "C:\Qt\5.12.5\mingw73_64\bin\qmake.exe"
"C:\Users\kevin\Downloads\cnhzdGF0aW9uX3VpLnppcA==\station_ui\station_ui.pr
o" -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug"
Usage: C:\Qt\5.12.5\mingw73_64\bin\qmake.exe [mode] [options] [files]

Since qmake did not print anything before that "Usage:" line, it can be from
this return in qmake/options.cpp:

 if(!handled) {
 return Option::QMAKE_CMDLINE_SHOW_USAGE |
Option::QMAKE_CMDLINE_ERROR;
 }

or from here:

 if(Option::mkfile::project_files.isEmpty()) {
 usage(argv[0]);
 return Option::QMAKE_CMDLINE_ERROR;
 }

The first one looks impossible to me: it would imply qmake_mode is still
"generate nothing" and I don't see how that is possible. So it must be the
second: the list of project files is empty. That means qmake somehow failed to
see anything in the command-line.

Obviously that is not supposed to happen. Looks like the runtime completely
failed to parse the GetCommandLineArgsW. Debugging is needed.


--
Thiago Macieira - thiago.macieira (AT) intel.com
   Software Architect - Intel System Software Products



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


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

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


Re: [Interest] Curious QNetworkAccessManager behavior.

2019-10-31 Thread Tony Rietwyk

Hi Jason,

You should only connect to QNetworkAccessManager::finished once - before 
sending any files.  You are adding another connection with each file.


From https://doc.qt.io/qt-5/qobject.html:

By default, a signal is emitted for every connection you make; two 
signals are emitted for duplicate connections. You can break all of 
these connections with a single disconnect 
() call. If you pass the 
Qt::UniqueConnection 
 /type/, the 
connection will only be made if it is not a duplicate. If there is 
already a duplicate (exact same signal to the exact same slot on the 
same objects), the connection will fail and connect will return an 
invalid QMetaObject::Connection 
.


Regards, Tony


On 1/11/2019 11:21 am, Jason H wrote:

I'm uploading files with QNAM.
QFile *file = new 
QFile(QString("%1/%2/%3").arg(_dataDir).arg(SERVER_SYNC_DIR).arg(filename));
if (file->open(QIODevice::ReadOnly)) {
QNetworkRequest 
req(QUrl(QString("%1/%2/%3").arg(_serverUrl.toString()).arg("post").arg(filename)));
req.setHeader(QNetworkRequest::ContentTypeHeader, "application/octet-stream");
QNetworkReply *reply = _nam.post(req, file);
_uploads[reply] = file;
connect(&_nam, ::finished, this, 
::handlePostFinished);


void ServerSyncFolder::handlePostFinished(QNetworkReply *reply) {
qDebug() << Q_FUNC_INFO << reply->url() << reply->errorString();
if (_uploads.contains(reply)) {
_uploads[reply]->close();
_uploads[reply]->remove();
_uploads[reply]->deleteLater();
_uploads.remove(reply);

}
reply->deleteLater();
}
Every time I upload a file, the handlePostFinished gets calle once for each 
file I've uploaded. For example, upload files 1.jpg, 2.jpg, 3.jpg, 4.jpg:

void ServerSyncFolder::handleDirectoryChanged(const QString &) 
"/var/mobile/Containers/Data/Application/8787E7C7-0940-4834-B6D5-1DF049AE4BEE/Documents/sync"
// will now post my file, after post is complete I get:
void ServerSyncFolder::handlePostFinished(QNetworkReply *) 
QUrl("http://10.12.0.37:57201/post/4.jpg;) "Unknown error"
void ServerSyncFolder::handlePostFinished(QNetworkReply *) 
QUrl("http://10.12.0.37:57201/post/4.jpg;) "Unknown error"
void ServerSyncFolder::handlePostFinished(QNetworkReply *) 
QUrl("http://10.12.0.37:57201/post/4.jpg;) "Unknown error"
void ServerSyncFolder::handlePostFinished(QNetworkReply *) 
QUrl("http://10.12.0.37:57201/post/4.jpg;) "Unknown error"

Server logs do not show that I am posting it repeatedly. It is calling my slot 
with the last URL it posted to, for as many files as I've uploaded so far.

Anyone have an idea why?
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


[Interest] How to obtain padding and border styling for QFrame derived control

2019-10-05 Thread Tony Rietwyk

Hi Everybody,

I have a QFrame derived widget that is styled using an application style 
sheet with optional padding and borders.  In the minimumSizeHint, I need 
to get the currently active values from the style sheet.  I would like 
to use sizeFromContents, but there is no ContentsType CT_Frame to adjust 
my contents rect.


In the paint event, I call QFrame::paintEvent to do the background and 
borders, then I paint my contents.  I expect contentsRect to be smaller 
due to the border and padding, but it isn't.  How can I get (or allow 
for) the style sheet values?


Regards, Tony

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


Re: [Interest] Receive key presses when hovering over a specific widget

2019-07-11 Thread Tony Rietwyk

Hi Sean,

AFAIK, the easiest way to trap keyPress/keyRelease irrespective of which 
widget has the focus is to install an event filter on the QApplication 
instance.  Use the mouseEnter/Leave events of the thumbnails to 
set/clear a currentThumbnail, and then in eventFilter only act on the 
'm' keyPress if the currentThumbnail has been set, and return false from 
the filter, otherwise return true so that the 'm' will go to the edit 
box or whatever.


Regards, Tony


On 11/07/2019 9:53 pm, Murphy, Sean wrote:

I'm trying to figure out the best way to receive key presses when the user 
hovers over a specific widget, and deliver that keypress information to the 
parent widget.

Say I've got three types of widgets:
1. thumbnailWidget - displays a low resolution version of a full resolution 
image, essentially based on QLabel
2. imageLibraryWidget - displays 1-N image thumbnail widgets. This widget is 
based on QWidget. Also owns all the full resolution images used to create the 
thumbnails
3. magnifierWidget - popup widget that displays a full resolution subset of the 
thumbnail. Think of it as just a magnifying glass that you can put over a 
portion of the thumbnail

Application hierarchy is as follows:
- MainWindow
 - multiple "other" widgets, some of which can receive keyboard focus 
(QLineEdits, QTextEdits, etc.)
 - one or more imageLibraryWidgets
 - multiple "other" widgets, some of which can receive keyboard focus
 - one or more imageThumbnailWidgets
 - one magnifierWidget

So the way I want this to work is that when the user hovers over a thumbnail 
widget AND presses a specific key, the imageLibraryWidget that is the parent of 
that thumbnail is notified that the correct keypress has been received, and 
knows which thumbnail (and which pixel of that thumbnail) the cursor is over. 
It then will popup the magnifierWidget with the appropriate full resolution 
pixels. When the user releases the key, or moves the mouse so they are no 
longer over a thumbnail, the magnifier is hidden.

I've got the mouse position portion taken care of, but I'm struggling to get 
the key press thing correct, especially given that other widgets (either child 
widgets of the imageLibraryWidget or children of MainWindow) might have the 
keyboard focus at the time the user moves the mouse over a thumbnail and 
presses the bound key. I still want the magnifier idea to work, ideally without 
changing the keyboard focus from the currently focused widget.

So the following should work:
1. User starts to type something in a line edit
2. Before finishing what they're typing they decide they need to double check 
something in the related image
3. User move cursor over image, and presses the key bound to the magnifier 
functionality. Let's say the key is 'm'
4. While over the image, and they are holding down the 'm' key, the keypress 
should be consumed and not get entered into the line widget

That's the ideal case, I can live with it if the user would lose keyboard focus 
in the line edit and has to click back in it after the above sequence if I have 
to.

Thoughts about how to go about this? I think I might need some combination of 
event filters and QHoverEvents, but not sure of the right combo at the moment.
Sean





This message has been scanned for malware by Forcepoint. www.forcepoint.com
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

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


Re: [Interest] App crashes on iOS when geocode or reverseGecode is used

2019-04-13 Thread Tony Rietwyk

Hi Roman,

Your qGeoService provider is on the stack and discarded at the end of 
your constructor.  The documentation for geocodingManager makes clear 
that the pointer returned is owned by the provider, so I assume the 
pointer becomes invalid.  Try keeping a pointer to the provider as well 
as the coder.


Hope that helps, Tony


On 13/04/2019 4:54 am, Roman Wüger wrote:


Hello Paolo,

Thanks for reply.

I use it so:

In the constructor I connect the signal from the geocoding manager

m_pGeoPositionUpdates = QGeoPositionInfoSource::createDefaultSource(this);

connect(m_pGeoPositionUpdates, 
::positionUpdated, this, 
::onPositionUpdated);


QGeoServiceProvider qGeoService("osm");

m_pQGeoCoder = qGeoService.geocodingManager();

m_pGeoPositionUpdates->startUpdates();

In the connected slot I will do this :

void MyClass::onPositionUpdated(const QGeoPositionInfo ) {

// QGeoLocation location;

// location.setCoordinate(positionUpdate.coordinate());

// QGeoAddress address(location.address());

// updateGeoAddress(address);

qDebug() << "Is Coord Valid: " << positionUpdate.coordinate().isValid();

qDebug() << "Coordinate: " << positionUpdate.coordinate();

if (m_pQGeoCoder) {

QGeoCodeReply *pQGeoCode = 
m_pQGeoCoder->reverseGeocode(positionUpdate.coordinate()); *// CRASH*


if (pQGeoCode) {

connect(pQGeoCode, ::finished, [=]() {

if (pQGeoCode->error() == QGeoCodeReply::NoError) {

const QList qGeoLocs = pQGeoCode->locations();

if (qGeoLocs.size() > 0) {

updateGeoAddress(qGeoLocs.first().address()); // This function handles 
the received address


}

}

else {

qDebug() << pQGeoCode->errorString();

}

});

}

}

}

Thanks in advance

Regards

Roman

-Ursprüngliche Nachricht-
Von: Interest  Im Auftrag von Paolo 
Angelelli

Gesendet: Freitag, 12. April 2019 15:37
An: interest@qt-project.org
Betreff: Re: [Interest] App crashes on iOS when geocode or 
reverseGecode is used


Hi, is the reply finished? do you get it from the finished signal of 
the manager?


Or are you trying to use what the method returns you immediately?

On Thu, 11 Apr 2019 22:42:36 +0200

Roman Wüger mailto:roman.wue...@gmx.at>> wrote:

> Hello,

>

> I try to get the city and country from coordinates.

> For this I use the functions geocode/reverseGecode. The pointer is 
valid but if the function is accessed with valid coordinates from the 
GeoPositionInfoSource signal,  I get a EXC_BAD_ACCESS


>

> I use “osm” as the geo service provider.

>

> Any hints?

>

> Regards

> Roman

> ___

> Interest mailing list

> Interest@qt-project.org 

> https://lists.qt-project.org/listinfo/interest

___

Interest mailing list

Interest@qt-project.org 

https://lists.qt-project.org/listinfo/interest


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


Re: [Interest] Signals, slots before the event loop starts?

2019-04-10 Thread Tony Rietwyk

Hi Jason,

Why can't your initialisation pass back a status to the main routine?

Otherwise I suggest to use a short timer, so it gets picked up early 
when the main event loop starts.


Hope that helps, Tony


On 11/04/2019 8:18 am, Jason H wrote:

I've now come across two places in my code where this is an issue (at various 
states of initializing)

In a QObject who is exported to QML, and is instantiated just below the 
top-level Window:
//  in the object's open() method:
if (!_serialPort.open(QIODevice::ReadWrite))
qApp->quit(); // won't actually quit - no use if I can't use the serial 
port. (because another instance is using it)

Then I have a ready() signal that is emitted when the serial device is ready, 
however the QML, when I hook onReady, it never gets called. I have to use a 
Component.onCompleted at the top level. However, there is async serial I/O 
happening, so there is at least one event loop?

What can I do to make sure these things work?




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

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


Re: [Interest] How to properly show progress for a signal processing pipeline

2019-04-08 Thread Tony Rietwyk

Hi Sean,

I would just show one progress set to 3 * raw count.  Each stage 
periodically signals to the ui thread its progress, and whether it has 
processed the end-of-data signal from the previous stage.  In the ui 
thread slot:


int totalCount, rawCount;

QVector stageProgress;

void stageProgressSlot(int stageIndex, int count, bool completed) {

    Q_ASSERT(count <= rawCount);

    auto thisCount = (if completed ? rawCount : count);

    Q_ASSERT(thisCount >= stageProgress[stageIndex]);

    totalCount += thisCount - stageProgress[stageIndex];

    stageProgress[stageIndex] = thisCount;

    ui->progress->setValue(totalCount);

}

It will always appear to start slowly then jump forward depending on the 
degree of filtering.  I can't see a way to avoid that other than Bill's 
idea.


Hope that helps,  Tony


On 9/04/2019 12:16 am, william.croc...@analog.com wrote:




  So the issue I'm having here is that I want to show the user some 
sort of progress indicator (this whole pipeline takes a bit of time), 
but at the start I only know the raw count, not any of the 
intermediate or final counts. And because the A->B->Final portion of 
the pipeline takes a noticeable amount of time, I can't just run the 
progress bar from 0 to Raw count, because then from the user's 
standpoint the progress bar would reach 100% once the number of raw 
samples is exhausted, not when processing is fully complete.




You could show three progress bars, one for each stage.
Assume each item will pass through each stage (which is pessimistic)
and show progress based on that. In most cases the whole
process will finish early based on the bars, but progress
will be shown.

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

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


Re: [Interest] QtLocation MapPolyLine and MouseArea

2019-03-07 Thread Tony Rietwyk

Hi Philippe,

Just to confirm - you are filtering your list of lines by using the 
bounding rectangle first, then doing the detailed line-segment check?


Regards, Tony


On 8/03/2019 4:32 am, maitai wrote:

Hi,

I need to trigger various actions whenever a MapPolyLine is hovered or 
pressed, such as displaying a tooltip, a menu, etc.


I have put a MouseArea on it with anchors.fills: parent, but the 
problem is that the mouse area does not represent the line, but the 
polygon made by the line. For instance if you have a L shape, entered 
event and so on is triggered when you enter the bounding rectangle of 
the line, not when you hover over the line itself.


On a QGraphicsScene we had the shape() protected method for that kinds 
of case, for instance with a QPainterPathStroker to give some 
thickness to the line's "mousearea".


I will probably end with a custom property that will carry the pixel 
distance between the line segments and the mouse coordinates, but this 
is going to be heavy to compute (I have potentially hundreds of 
complicated lines on the map).


Is there a better way or even better a standard way to do that?

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

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


Re: [Interest] Weird sizing in Qt Designer 5.12.0 with hi-res screen

2019-01-23 Thread Tony Rietwyk

Hi Dmitriy,

The software is at https://www.risingsoftware.com/ and covers both 
aspects that you mention.  It can generate progressions, or use supplied 
set pieces and notation.  The student can either annotate the notation 
with the chord symbols - or even fill in the voices as well.  The 
student may or may not actually hear the progression.  It's wonderful 
software to work on - sure beats boring business crap!


Regards, Tony


On 24/01/2019 8:49 am, Dmitriy Purgin wrote:
Off topic but out of curiosity: what is the software you have on your 
screenshot? A harmony learning helper or some kind of a harmony 
progression generator?


Cheers
Dmitriy

On Wed, Jan 23, 2019 at 2:52 AM Tony Rietwyk <mailto:t...@rightsoft.com.au>> wrote:


Hi Everybody,

I have recently installed a hi-res screen 3840 x 2160 @ 150%
scaling on
my Windows 10 machine.

The attached screen capture has Qt Designer on the right of the
actual
running dialog, with a screen ruler on top of the designer. You
can see
the following:

- Designer is showing the form at double the size it should be
(1200 for
a form at minimum size 600 high).

- Even the grid spacing has been stretched.

- We do not set any of the newer high-res related settings at run
time,
so the dialog appears at the expected 600 pixels high. Instead we use
style sheets to adjust fonts, images, etc.

Why is Designer doing this?  Where is it getting the factor of 2
from?
How do I get it to display the form at the correct size?

Regards, Tony

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

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


Re: [Interest] SQL databases and threading

2018-10-14 Thread Tony Rietwyk

Hi,

AFAIK, you have to open the QSqlDatabase, do QSqlQuery prepare and exec, 
read the results, do the next query, etc. all within one thread.  You 
can have multiple threads accessing simultaneously, if the underlying 
database supports it.  But you cannot send the query in one thread, then 
read the results in another.


Regards, Tony


On 12/10/2018 5:52 PM, Konstantin Shegunov wrote:

Hello,
Is there any way to tell (besides looking at the sources) if a given 
SQL plugin, or single methods of it, is reentrant/thread safe? The 
docs are rather evasive on the issue ...
What would be allowed to do if I want to thread the SQL queries? Can I 
serialize the exec/prepare and then pull the resultset in another thread?
Ideally I would like to process the results in a thread if possible, 
even if I have to serialize the exec.


Currently I'm working with the PQSQL driver, but general answers are 
acceptable as well.


Thanks in advance.
Kind regards.


___
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] Capture keyPressEvent on QMenuBar/QMenu?

2018-10-10 Thread Tony Rietwyk

Hi Israel,

Try installEventFilter on the menu to see the KeyPress events before 
they are handled by the menu.


Regards, Tony


On 11/10/2018 7:07 AM, Israel Brewster wrote:
I want to modify a QAction if the user holds down a specific key. You 
can see similar behavior on the Mac, for example, if you pull down the 
Apple menu and press/release the option key - "About This Mac" changes 
to "System Information...", among other things. This is the behavior I 
want to emulate in my application.


To that end, I tried overriding the keyPressEvent on both the QMenuBar 
and the QMenu containing the QAction. However, my debugging indicated 
that neither of these keyPressEvent functions were called when 
pressing any key with the relevant QMenu displayed.


I'm sort of wondering if this is perhaps due to the event being 
handled at a lower level in order to provide "type ahead" type 
functionality in the menu? I did notice that different menu entries 
are selected when typing various keys, which I believe to be normal 
behavior.


Regardless, how can I respond to a keyPress type event in a QMenuBar 
or QMenu?


---
Israel Brewster




___
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] Struggling with moveEvent()

2018-10-01 Thread Tony Rietwyk

Hi Sean,

Widgets are normally positioned relative to their owner - the exception 
is popup menus, which are screen absolute.  I would expect a popup menu 
to automatically close when the title bar is clicked.  How have you 
implemented your captionPopupMenu?  Does it capture the mouse when it is 
visible?  It should close if the mouse is clicked anywhere outside its 
borders.  Since you've got a QPushButton, did you consider using its 
setMenu to achieve a similar result?


Regards, Tony


On 2/10/2018 4:11 AM, Murphy, Sean wrote:

My basic question is how do child widgets get moved or repainted when some 
ancestor of theirs moves?

Here's the more detailed issue, first the widget hierarchy:
QMainWindow
CustomerHeaderTable (inherits from QTableWidget)
CustomTableHeader (inherits from QHeaderView, allows you to put widgets 
in the header sections)
dataConfigWidget (inherits from QWidget)
QPushButton
captionPopupMenu (inherits from QWidget, starts out hidden)

What I'm trying to accomplish is when the user presses the QPushButton, that a 
custom popup menu (the captionPopupMenu) appears aligned to the pushbutton. 
Right now I've got the initial alignment working just fine. The issue is when 
the popup is visible, if the user then grabs the application title bar and 
moves the entire main window around, the popup isn't moving with the 
application. So I figured I just need to update the captionPopupMenu's position 
in dataConfigWidget's moveEvent() to keep it positioned correctly. But it 
appears when the main window moves around, the dataConfigWidget's moveEvent() 
is never called - I put some qDebug() statements in there to verify. Same goes 
for paintEvent() - my child widgets aren't getting called when the ancestors 
move.

So I'm not sure what I need to trigger off from to detect when I need to 
reposition the menu. I feel like I'm missing something really obvious, but not 
seeing it on a Monday apparently.
Sean



This message has been scanned for malware by Forcepoint. www.forcepoint.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


Re: [Interest] WebVuew::runJavaScript problems

2018-08-23 Thread Tony Rietwyk

Hi Jason,

When are you calling runJavaScript?  How are you loading the page?  How 
do you know that the page has finished loading?  I suggest to listen for 
the loadingChanged signal and then do the processing there when the 
status is LoadSucceededStatus.  I assume that you are calling 
QtWebView::initialize() during application startup?


Hope that helps, Tony


On 24/08/2018 8:57 AM, Jason H wrote:

So thanks to sugestiosof including a timestamp, that works.
I'm happy everywhere except for iOS. When I try to get my testResult, 
on iOS it is ALWAYS 'undefined'. I'm now using:

try {testResult} catch (e) {'undefined'}
(where testResult is at top-level scope:
var testResult = "incomplete";
So I should at least get "incomplete".  So what do I have to do to get 
testResult in iOS?

*Sent:* Thursday, August 23, 2018 at 7:59 AM
*From:* "Jérôme Godbout" 
*To:* "Jason H" 
*Cc:* "interestqt-project.org" 
*Subject:* Re: [Interest] WebVuew::runJavaScript problems
you can always add a request argument with current datetime to your 
request url, this avoid caching:

https://myserver.org?date=20180823_085632
even if you don't use the argument, it would not cache it
On 23 August 2018 at 00:58, Jason H > wrote:


I think I'm also seeing a caching problem where the server is
updated but I'm getting old html code. Can I invalidate the cache?

> Sent: Wednesday, August 22, 2018 at 10:56 PM
> From: "Jason H" mailto:jh...@gmx.com>>
> To: "interestqt-project.org "
mailto:interest@qt-project.org>>
> Subject: [Interest] WebVuew::runJavaScript problems
>
> I'm trying to load and get a variable that is changed by the page.
> webview.runJavaScript("testResult", function(result){
>       console.log('webview result', result);
> });
>
> The html is
> 
>       
>       var testResult="";
>       
>       
>
>       
> 
>
> But the output is:
> qml: webview result undefined
>
> What am I doing wrong?
> ___
> 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] Problems with QCamera/QML Camera when trying to porting a desktop application to android tablet

2018-08-22 Thread Tony Rietwyk

Hi Roman,

Why did you need to use createWindowContainer? Wouldn't the QQuickView 
do as a window anyway?  Have you added a layout to manage sizing the 
QQuickView within the created window?


Are you using resizeMode SizeRootObjectToView?  I think the paragraph in 
QQuickView documentation starting 'QQuickView also manages the sizing 
...' is incorrect, whereas the description in the enum 
QQuickView::ResizeMode makes more sense.


Hope that helps!

Tony


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


Re: [Interest] QTreeWidget displays blank widget

2018-08-10 Thread Tony Rietwyk

Hi Nicolas,

Try using a QFrame for SimpleWidget - you may be able to get rid of 
widget_2.


I'm surprised that the nested QWidget worked, as QWidget doesn't 
normally draw a background.


Hope that helps, Tony


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


Re: [Interest] Clearing QMainWindow::setFilePath() on macOS

2018-07-19 Thread Tony Rietwyk

Hi Patrick,

Have you tried passing QString() - maybe the underlying routine 
(incorrectly) checks for isNull rather than isEmpty()?


Regards, Tony


On 20/07/2018 3:05 AM, Patrick Stinson wrote:

Hello!

I have set a file path on my QMainWindow with QWidget::setWindowFilePath() on 
macOS. I need to clear this setting, but it doesn’t work if I pass in “”. Is 
there another way to do this?

Thanks!
-Patrick
___
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] Running Qt application on Linux without screen

2018-06-18 Thread Tony Rietwyk

Hi Tomasz,

I think in Windows, it simply is not possible for a service app to also 
run in desktop - they have separate desktops.  The usual solution is to 
move data and commands between the service and desktop app via some form 
of inter process communication - TCP, pipes, mailslots, etc.


Can you use the same techniques in your app?  You should be able to 
easily split it, depending on how much data the desktop needs?


Hope that helps, Tony


On 18/06/2018 9:26 PM, Tomasz Olszak wrote:

Hello,

Has anyone of you needed to handle following use case?


1. Linux
2. Full screen GUI app -  fast as much as possible so no X, considered 
eglfs over drm and wayland

3. It starts as a service without screen
4. Screen can be connected at any time - app should be visible on screen

3 seems currently impossible with Qt 5.10 (is there a point updating 
it to 5.11).


What I tried so far:
1. Eglfs app works ok with screen connected
2. Eglfs crashes when no screen connected in egl qpa
3. Eglfs work ok when I add in eglfs configuration file 
(QT_QPA_EGLFS_KMS_CONFIG) certain modeline string as mode. However 
when screen is connected there is no QGuiApplication::screenAdded 
signal so I can't show application on different screen.
4. on Qt Wayland app exits with "Running on a compositor with no 
screens is not supported". It comes 
from QWaylandIntegration::initialize() and compositor is weston


Any ideas how to approach such case?







___
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] Qt5 CSS StyleSheet Variables

2018-05-21 Thread Tony Rietwyk

Hi Mike,

QStyleSheets are pretty limited, so we:

- load a sass file from Qt resources,

- inject some calculated variables at the start relating to the specific 
app and client screen size,


- process the sass to css

- set the output into QApplication.

This occurs at startup, and whenever the screen changes.

Hope that helps, Tony


On 22/05/2018 1:17 AM, Christian Ehrlicher wrote:

Am 21.05.2018 um 15:47 schrieb Michael Jackson:
Just to confirm, but does Qt accept CSS variables as describe here: 
 ?


I tried and I get the error that the style sheet could not be parsed. 
I have a style sheet with a LOT of color settings and having to do a 
bunch of search/replace to change the colors is error prone at best.



http://doc.qt.io/qt-5/stylesheet-reference.html should be your reference.

Christian


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


Re: [Interest] resizable QTextEdit

2018-04-15 Thread Tony Rietwyk

Hi Alexander,

Does layout::invalidate before activate help?

Regards, Tony


On 15/04/2018 6:53 PM, Alexander Semke wrote:

On Freitag, 13. April 2018 10:22:14 CEST Igor Mironchik wrote:

Something like this?
[...]

Thanks Igor, I've got the idea. The resize works fine now but I have the
problem with the layout of the parent widget being not updated. My text edit
widget is embedded into a QFrame with a vertical layout. After the manual
resize I need the layout(s) and the sizes/positions of this frame and of all
the other widgets frame's parent to be adjusted to the new size of the text
edit.

https://imgur.com/a/eV2Fj - here the height of the text edit widget was made
smaller but the QFrame widget where the text edit is placed in a vertical
layout was not resized. I'm calling frame->layout()->activate() to trigger the
recalculation but this doesn't lead to the desired effect...  Do I new to
resize the frame widget here manually or are there any other methods to
update/recalculate the layout?




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


Re: [Interest] Query for qml testing

2018-04-02 Thread Tony Rietwyk

Hi Himanshu,

You have a lot of code.  If you are setting the value in qml, why do you 
need to ask how to get the value?  Can you be more specific - where are 
you setting the value?  What test framework are you using that needs to 
read it?


Regards, Tony


On 3/04/2018 2:02 PM, Himanshu Vishwakarma wrote:

Hi,

I am doing the unit testing of a qml file
https://github.com/gcompris/GCompris-qt/tree/master/src/activities/balancebox/editor
In this file, I want to test the behaviour of change the border.color
of Rectangle, while OnClicked on the Rectangle.

My question is, Is there is any method to get return the border.color value
of a rectangle in qml??
OR
What are the methods by which I can test this file??

Please help me!!

Thanks!!


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


Re: [Interest] MQTT Client Message Routing

2018-01-29 Thread Tony Rietwyk

Hi Andrew,

I haven't used QMqtt.  Nonetheless, I would suggest a hybrid - using a 
separate subscription object for each folder in the hierarchy.  So the 
client subscription only needs to match on the terminal symbol and 
coordinates all of the actions relating to clients.


Regards, Tony


On 29/01/2018 10:21 PM, Andrew Ialacci wrote:


Hello Qt Friends!

When using the QMqtt library, I've noticed there are two possible ways to 
inspect messages received by the client from the broker.

1. QMqttClient::messageReceived(const QByteArray , const QMqttTopicName 
)
2. QMqttSubscription::messageReceived(const QMqttMessage & message)

I understand that the first will be a firehose of all messages being received 
by the client. The second is to only see messages having to do with a specific 
subscription.

Consider the following scenario:

// Example Topic Hierarchy
- app/users/$user/$client/friends
- app/users/$user/$client/conversations
- app/users/$user/$client/events

// Questions:

- Is it better to maintain individual QMqttSubscription objects for all 
possible topics a client is interested in and connect to each 
QMqttSubscription::messageReceived signal?

- Or does it make more sense to have a single subscription to a root topic (where applicable, 
in this case: "app/users/$user/$client/+" ), a bunch of IFs, and 
QMqttTopicFilter::match(const QMqttTopicName ) to handle each case?

- It feels like maintaining a huge list of subscription objects will get 
annoying. However, is doing so worth it in terms of performance? Does it 
somehow reduce the overhead of matching strings all over (either internally in 
the QMqttClient or by my calling QMqttTopicFilter::match)?

// Example of "switching" on topic in a QMqttSubscription::messageReceived 
handler
// using QMqttTopicFilter::match.
// Note:
//   Please ignore syntax / coding / technical errors.
//   This was written freehand purely to illustrate my point.

void AppMessageRouter::handleMQTTMessageReceived(const QMqttMessage 
)
{
 if 
(QMqttTopicFilter("app/users/$user/$client/friends").match(mqttMessage.topic()) 
== true)
 {
 this->routeFriendsMessage(mqttMessage);
 return;
 }

 if 
(QMqttTopicFilter("app/users/$user/$client/conversations").match(mqttMessage.topic())
 == true)
 {
 this-> routeConversationsMessage(mqttMessage);
 return;
 }

 if (QMqttTopicFilter("app/users/$user/$client/ events 
").match(mqttMessage.topic()) == true)
 {
 this->routeEventMessage(mqttMessage);
 return;
 }
}

Thanks for your time!






___
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] Problem with QAbstractProxyModel in PyQt 5.9.1

2017-12-17 Thread Tony Rietwyk

Hi Jérôme,

I assume that parent.isValid is checking the parent QModelIndex by 
calling parent.model().columnCount within the DummyModel. There used to 
be a Qt utility to check that your models have the correct overrides.  
Note that the source model cannot rely on the proxy model for anything - 
it must be self contained.


Regards, Tony


On 18/12/2017 1:04 AM, Jérôme Laheurte wrote:
I’m trying to use a QAbstractProxyModel (more specifically a 
QIdentityProxyModel) to present differently columned models for the 
same underlying model. So the source model doesn’t implement 
column-related stuff, but the proxy model does. It goes like this:


/#!/usr/bin/env python3/
/#-*- coding: ISO-8859-1 -*-/

*from* PyQt5 *import* QtCore, QtWidgets

*class* DummyModel(QtCore.QAbstractItemModel):
*def* rowCount(self, parent):
*if* parent.isValid():
*return* 0
*return* 10

*def* parent(self, index):
*return* QtCore.QModelIndex()

*def* index(self, row, column, parent):
*if* parent.isValid():
*return* QtCore.QModelIndex()
*return* self.createIndex(row, column)


*class* ProxyModel(QtCore.QIdentityProxyModel):
*def* __init__(self, model):
super().__init__()
        self.setSourceModel(model)

*def* columnCount(self, parent):
*return* 3

*def* data(self, index, role):
*if* index.isValid() *and* role == QtCore.Qt.DisplayRole:
*return* 'Item #%d,%d' % (index.row(), index.column())


*class* MainWindow(QtWidgets.QMainWindow):
*def* __init__(self):
super().__init__()

        view = QtWidgets.QTreeView(self)
        view.setModel(ProxyModel(DummyModel()))
        self.setCentralWidget(view)

        self.show()
        self.raise_()


*if* __name__ == '__main__':
    app = QtWidgets.QApplication([])
    win = MainWindow()
    app.exec_()

Unfortunately running this gives me this on the console:

NotImplementedError: QAbstractItemModel.columnCount() is abstract and 
must be overridden


And nothing displays unless I define `columnCount` in the source 
model. So my guess is that some method in QAbstractProxyModel *other 
than columnCount()* calls sourceModel()->columnCount() directly 
instead of the proxy’s version. Is that a bug ?


Best regards
Jérôme Laheurte



___
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] Change QCheckBox to QPushButton in a QTableView

2017-12-06 Thread Tony Rietwyk

Hi Jason,

You'll have to initialise quite a bit more in the QStyleOptionButton 
button than just the text - especially the inherited rect member.   
Maybe QStyleOption.initFrom can help, or create an override class on 
QPushButton to expose its initStyleOption.


Hope that helps, Tony


On 7/12/2017 10:21 AM, Jason H wrote:

I have a model, a few columns of which are supposed to be QPushButtons.
I've got it working with checkboxes just fine, and I can get the QPushButtons 
to display while editing.
But I want to display the checkable QPushButton reflecting it's checked state 
to be displayed all the time, not just when editing.

I looked at the stars delegate example, but that's got some rudimentary 
painting.
I found the ProgressBar example in QAbstractItemDelegate, but that didn't worl

void ButtonDelegate::paint(QPainter *painter, const QStyleOptionViewItem , 
const QModelIndex ) const {
if (index.column() == 0) {
QStyleOptionButton button;
button.text = _text;
QApplication::style()->drawControl(QStyle::CE_PushButton, 
, painter);
} else
QStyledItemDelegate::paint(painter, option, index);
}

QSize ButtonDelegate::sizeHint(const QStyleOptionViewItem , const 
QModelIndex ) const {
return QSize(50,10);
}

But all I got out of it was a black pixel in the first cell.


___
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 QFontMetrics boundingRect failed to textwordwrap, thanks!

2017-11-29 Thread Tony Rietwyk

Hi,

In your call metrics.boundingRect, you have specified height=0. Doesn't 
that make the QRect invalid?  The help for this function states "The 
drawing, and hence the bounding rectangle, is constrained to the 
rectangle rect." - so you need to pass a very large value for height, 
and it should then work.


Regards, Tony


On 28/11/2017 12:06 PM, sq wrote:
Hello, in QT4.8 I have the following code, want to calculate the size 
of the rectangle with the line break, the result of the rect did not 
wrap at all.
How can I get the size of rect that a  long QString needed 
text-wrapped automatically?Thanks very much!


    QPainter painter(this);
    QString text("1234567890123456789012345678901234567890"
 "1234567890123456789012345678901234567890"
 "1234567890123456789012345678901234567890"
 "1234567890123456789012345678901234567890");
    int width = this->width()-40;
    int flags = Qt::TextWordWrap;
qDebug()<<"font:"<

Re: [Interest] Calling QT Class method from pthread thread

2017-10-04 Thread Tony Rietwyk

Hi Gonzalo,

I don't think the documentation is clear enough, but my assumption is 
that emitting a signal connected with BlockingQueuedConnection can only 
be done in a thread created by QThread that has called QThread.exec in 
its run override. Does your callback thread really have to wait for the 
main thread to finish executing its slot? If not, then I think just 
using QueuedConnection should work from a non-QThread.


Regards, Tony


On 4/10/2017 10:08 PM, Gonzalo Aguilar Delgado wrote:


Hello,

I'm facing a problem that don't know how to tackle. I created a 
library that runs on C. It's based on callbacks and it seems to work 
in other projects well.


When connecting to Qt and classes I found a couple of problems that 
now they are extending.


It seems that I cannot set a callback from C directly to a class, so I 
created an intermediate static function that will wrap the call to the 
class.


static gboolean callbackWrapper(SG64ZeroMQ* mq, ThriftStruct* message, 
gpointer data, GError **error) {    qDebug("Message received");    
MQMessageManager *self = static_cast(data);    
fflush(stdout);    qDebug("Thread of the call %x", 
QThread::currentThread());    self->processMessage(mq, message, 
error);    return TRUE;}


Nice. We get the class from the callback. Do a static cast and go 
ahead with processing. But I want to notify other class that a event 
happend, with a Signal.


For completeness I include also constructor.

MQMessageManager::MQMessageManager() 
:error(NULL),mqsubscriber(NULL){qDebug("Thread of the class %x", 
QThread::currentThread());}


bool MQMessageManager::processMessage(SG64ZeroMQ* mq, ThriftStruct* 
message, GError **error){    mqPayload *payload=NULL;    mqCardEvent 
*cardEvent = NULL;    mqMessage *msg=NULL;    QString str;    
g_return_val_if_fail (THRIFT_IS_STRUCT (message), FALSE);    
if(IS_MQ_MESSAGE(message))  msg=MQ_MESSAGE(message);    
switch(msg->type){  case MQ_MESSAGE_TYPE_COMMAND:    
puts("Received a command");    break;  case 
MQ_MESSAGE_TYPE_GPS_EVENT:    puts("Received a gps event");    
break;  case MQ_MESSAGE_TYPE_CARD_EVENT:    
if(IS_MQ_CARD_EVENT(msg->payload->card_event)){    cardEvent = 
msg->payload->card_event;    if(cardEvent!=NULL && 
cardEvent->atr!=NULL){    QByteArray array((char 
*)cardEvent->atr->data, (int) cardEvent->atr->len);    
QString atr = QString(array.toHex());    qDebug("ATR found 
of size %d, %s", cardEvent->atr->len, 
atr.toLatin1().data());*    emit 
cardValidationSuccess();    qDebug("Emitted valid 
signal");*    }    }    break;  default:    
printf("Message of type %i cannot be managed\n", msg->type);    
break;    }    return TRUE;}


Of course I did the typical connect signals functions. Done in the 
MainWindow.cpp class. After object creation and all the stuff.


    qDebug("Thread of the connect %x", QThread::currentThread());    
if(!QObject::connect(mqMessageManager, 
SIGNAL(cardValidationSuccess()), this, 
SLOT(displayValid()),Qt::QueuedConnection)){    qDebug("Cannot 
connect signal");    }    QObject::connect(mqMessageManager, 
SIGNAL(valid(QString)), this, SLOT(displayValid(QString)), 
Qt::BlockingQueuedConnection);


Well, when the emit is called the system blows up!

My investigations tells me that since the emit is called from the 
callback thread and the class was created in another thread there's a 
problem there that avoids the system to correctly function. The 
problem is that everyone tells me that signal emission doesn't has 
anything to do with thread affinity. I don't think so with the proof 
in my hand.


When you run the code the log is shown like this:

Thread of the class 557845a0

Starting ticketing

Thread of the connect 557845a0

Connecting localhost

Connected to server

Message received

Thread of the call c00024f0

ATR ...

---Crash on emit---

The question is. Is there any way to run self->processMessage(mq, 
message, error); On the same thread the class was defined 0x557845a0 
instead of the calling thread 0xc00024f0?


I defined process message like a slot. But if I use invokeMethod it 
also crash when calling it. I suppose because the same issue. 
moveToThread also doesn't work and it fails, I suppose because the 
same problem.


The root of the issue to me is that a pthread doesn't have all the 
information that QT injects into the software and it makes everything 
run there to blow up when using QT mechanism. Since the support is not 
enable on that thread.


Any help on this?

Best regards,



___
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] Strange visibility problem after updating entities in Qt3D

2017-10-03 Thread Tony Rietwyk

Hi Helmut,

I think your deleteChildrenRecursively is incorrect - you need to 
process the vector in reverse if you delete the current node. Especially 
as you have declared the vector parameter 'const &', the compiler 
probably can't work out that deleting the node will update the vector.  
So deleting some children will be skipped.


Regards, Tony


On 4/10/2017 2:20 AM, Helmut Mülner wrote:


Background:

==

   I have a QML application with big parts written in C++ (mostly 
models) that are exposed to QML with setContextProperty.


  I also have a 3DScene in QML:

Scene3D{

id:/scene3d/

width:4

focus:true

aspects:["input","logic"]

cameraAspectRatioMode:Scene3D.AutomaticAspectRatio

enabled:/visible/

visible:false

entity:controller.railViewer

}

Step 1:

=

railViewer is a pointer to a class derived from Qt3DCore::QEntity.

It displays a part of a rail with special markers for “defects”.

There is a “current defect” that is highlighted.

My entity has the following childs (I gave “my” entities an objectName):

Qt3DRender::QRenderSettings

Qt3DExtras::QOrbitCameraController

Qt3DRender::QObjectPicker

Qt3DInput::QInputSettings

Qt3DCore::QEntity   RailPart-0

Qt3DCore::QEntity   RailPart-1

Qt3DCore::QEntity   RailPart-2

Qt3DCore::QEntity   RailPart-3

Qt3DCore::QEntity   RailPart-4

Qt3DCore::QEntity   RailPart-5

Qt3DCore::QEntity   RailPart-6

Qt3DCore::QEntity   RailPart-7

DefectBoxEntity   RailDefect-1501

set alpha to  0.95 for  0

DefectBoxEntity   RailDefect-1502

set alpha to  0.4 for  1

(see rail1.jpg).

The 3D view works like a charm.

Step 2:

=

Now I want to show another rail (it may have fewer or more parts) and 
another set of defects.


The view from the side looks good (see rail2.jpg).

But if I tilt the view, the visibility of the first two boxes is wrong.

My childs now are:

Qt3DRender::QRenderSettings

Qt3DExtras::QOrbitCameraController

Qt3DRender::QObjectPicker

Qt3DInput::QInputSettings

Qt3DCore::QEntity   RailPart-0

Qt3DCore::QEntity   RailPart-1

Qt3DCore::QEntity   RailPart-2

Qt3DCore::QEntity   RailPart-3

Qt3DCore::QEntity   RailPart-4

Qt3DCore::QEntity   RailPart-5

Qt3DCore::QEntity   RailPart-6

Qt3DCore::QEntity   RailPart-7

DefectBoxEntity   RailDefect-501

set alpha to  0.95 for  0

DefectBoxEntity   RailDefect-502

set alpha to  0.4 for  1

DefectBoxEntity   RailDefect-503

set alpha to  0.4 for  2

DefectBoxEntity   RailDefect-504

set alpha to  0.4 for  3

DefectBoxEntity   RailDefect-505

set alpha to  0.4 for  4

DefectBoxEntity   RailDefect-506

set alpha to  0.4 for  5

DefectBoxEntity   RailDefect-507

set alpha to  0.4 for  6

DefectBoxEntity RailDefect-508

set alpha to  0.4 for  7

To update the scene I remove all Rail.* entities and insert the new ones.

These are the relevant parts of this code:

voiddeleteChildrenRecursively(constQt3DCore::QNodeVector& vector)

{

Qt3DCore::QNode* nullParent= nullptr;

for(auto* node: vector) {

auto* entity= dynamic_cast(node);

if(entity) {

autocomps= entity->components();

entity->setParent(nullParent);

for(auto* component: comps) {

component->setParent(nullParent);

entity->removeComponent(component);

deletecomponent;

    }

    }

deleteChildrenRecursively(node->childNodes());

deletenode;

    }

}

voidRailEntityPrivate::load(doubleframeHeight, 
conststd::/vector/>& finalPointVecs)


{

Q_Q(RailEntity);

Qt3DCore::QNode* nullParent= nullptr;

qDebug() <<"RailEntityPrivate::load:";

autochilds= q->childNodes();

for(auto& node: childs) {

qDebug() className() <<" 
"<objectName());


    }

qDebug() <<"";

Qt3DCore::QNodeVectorrailNodes;

length= frameHeight* 3.0;

railNodes.reserve(childs.size());

for(auto* node: childs) {

if(node->objectName().startsWith(QLatin1String("Rail"))) {

railNodes.push_back(node);

    }

    }

for(auto* node: railNodes) {

Qt3DCore::QEntity* entity= (Qt3DCore::QEntity*)node;

entity->setParent(nullParent);

autoec= node->childNodes();

deleteChildrenRecursively(ec);

deleteentity;

    }

currentDefectIndex= -1;

computeExtend(finalPointVecs);

/size_t/startList= 0u;

/size_t/endList= finalPointVecs.size();

for(autoi= startList; i< endList; ++i) {

autoentity= newQt3DCore::QEntity(q);

entity->setObjectName(QStringLiteral("RailPart-") +QString::number(i));

autoflength= static_cast(length);

automesh= newRailGeometryRenderer(finalPointVecs[i].second, flength);

automaterial= newQt3DExtras::QNormalDiffuseMapMaterial();

material->setShininess(10.0f);

material->setAmbient(QColor(76, 84, 76));

material->setSpecular(QColor(20, 20, 20));

autoseed= static_cast(currentFrameNr* 100u + i);

autoheightMap= RailEntityPrivate::createRandomHeightMap(1024, 512, seed);

auto* diffuseImage= newMyTextureImage(heightMap);

material->diffuse()->addTextureImage(diffuseImage);

autonormalMap= RailEntityPrivate::makeNormalMapFromHeightMap(heightMap);

auto* 

Re: [Interest] Issue with toLatin1()

2017-09-14 Thread Tony Rietwyk

Hi Sudhir,

Looks suspicious - I would expect that routine to be in qt5core. Have 
you tried a full rebuild of your project?  Since going to VS2015, I have 
to do this at least once a day, as the debug information is often stale 
when the program runs.


Regards, Tony


On 14/09/2017 4:34 PM, Sudhir Sharma wrote:


Hi,

I am getting following error while executing my application on QT 
5.9.1 with VS2015 (win64).


Any idea what could be issue?

“The procedure entry point tolatin1 could not be located in qt5xml.dll”

Regards,

Sudhir




http://www.mindtree.com/email/disclaimer.html


___
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 Android - Mouse Hovering Events

2017-07-16 Thread Tony Rietwyk

Hi Robert,

In the widgets have you setMouseTracking to true?

Or was your code working in previous Qt versions, and now isn't?

Regards, Tony


On 16/07/2017 6:22 PM, Robert Iakobashvili wrote:

Dear Oleg,
Thank you for your prompt reply.

My Qt Android App is written in Widgets.
That could make more sense for Android desktops like Chromebooks.

If somebody is more knowledgeable about Android widgets
and status of mouse hovering events there, it would be very much appreciated.

Kind regards,
Robert


On Sun, Jul 16, 2017 at 11:16 AM, Oleg Evseev  wrote:

Hi, Robert

As I saw the Material and Universal styles have gained hover effects in Qt
5.8 in Qt Quick Controls 2.1
http://blog.qt.io/blog/2016/10/06/qt-quick-controls-2-1-and-beyond/

https://youtu.be/43HrMH379-E

I suppose it works on Android.

---
With regards, Oleg

2017-07-16 10:49 GMT+03:00 Robert Iakobashvili :

Hi,
Android-7 has mouse hovering events and may be they are even earlier.

When using Qt-5.7.1, however, I do not see the events are coming,
at least true for widgets.

Does anybody knows if they are supported by Qt?

Many Chromebook devices have a mouse-keyboard experience
and no touch screen.

Kind regards,
Robert
___
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] Looks like a bug to me.

2017-06-04 Thread Tony Rietwyk
> Sent: Sunday, 4 June 2017 11:26 PM
> 
> Hello (No, this is not spam):
> 
> For me, the following:
> 
>QString a = "XXX";
>QString b = "";
>QString c = "";
>QString d = "1";
>qDebug() << QString("A: %1%2%3%4") .arg(a) .arg(b) .arg(c) .arg(d);
>qDebug() << QString("B: %4%1%2%3") .arg(b) .arg(c) .arg(d) .arg(a);
> 
> prints this:
> 
>"A: XXX1"  # As expected.
>"B: XXX"   # Expected: XXX1.
> 
> I think the 'B:' line demonstrates a bug.
> Where is the '1'?
> 
> Qt 5.7
> RedHat Enterprise Linux 6.8
> gcc: 4.9.3
> 
> Bill

Hi Bill, 

For the second one, consider that after arg(d) is executed, the input string to 
arg(a) is "B: %41".  Since 41 is now "the lowest numbered place marker", "XXX" 
gets substituted.  It is easy to mistakenly think that QString magically treats 
multiple .args as somehow being indexed.  I think the documentation for 
QString.arg should warn about your example, and the case when substituted 
strings contain %. 

Regards, Tony


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


Re: [Interest] QtDesigner needs redesign.

2017-01-04 Thread Tony Rietwyk
Hi Serge, 

 

I agree that it's painful not having a debug build of Qt Designer provided 
pre-built.  It might make using custom widgets a bit easier.  You need to 
thoroughly debug your widget in the application BEFORE you try to load and use 
it in Designer.  If the widget relies on other resources (like images eg), then 
they need to be setup and available in the interface initialize routine as 
well.  

 

My problems with Qt Designer: 

 

1) Custom widgets are not included in the list of widgets to promote from.  

 

2) Unable to configure designer settings to load style sheets - even just one 
style file would do!  

 

3) No way to provide a base class for generated ui classes.  

 

Regards, 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


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

2016-06-27 Thread Tony Rietwyk
Answering my own question! 

I stumbled upon an article that mentioned OTHER_FILES and DISTFILES.
OTHER_FILES didn't work, but DISTFILES does quite nicely.  The files appear
in their own group Distribution Files in the VS Solution Explorer, and don't
affect the output of the build.  Most importantly, the editor remembers the
files even after regenerating the project, and the DPACK editor extension
allows me to quickly select the files to open using Alt-U.  

Yay! 


> -Original Message-
> From: Interest [mailto:interest-bounces+tony=rightsoft.com.au@qt-
> project.org] On Behalf Of Tony Rietwyk
> Sent: Thursday, 26 May 2016 11:07 PM
> To: interest@qt-project.org
> Subject: [Interest] Adding editable files to VS2013 project via .pro and
qmake
> 
> 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

___
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


[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] 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] 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


[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] 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


[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


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


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] 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] [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] 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] 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


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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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] 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


  1   2   >