| Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date | |
| All threads index page 3 | |
Hi Everybody,
Does anybody know:
1. Could I connect QHttp directly to QProgressBar, without intermediate
class to convert signal dataReadPrgress(int,int) to slot setValue(int) ?
What happens with dataReadPrgress if client tries to download file
bigger than MAX(int) ?
2. Could I pass through QVariant class that doesn't have constructor
without parameters.
It looks like
Q_DECLARE_METATYPE ( someClass );
require someClass to have someClass()
3. Does code below
qRegisterMetaType<QModelIndex>("QModelIndex") ;
required to use QTableWidgetItem::setText() ?
4. Does mutex around QScrollBar::setValue() is required. I got
a lot of warnings about recursive repaint otherwise.
Thank you!
--
[ signature omitted ]
Dmitry Samersoff wrote:
>1. Could I connect QHttp directly to QProgressBar, without intermediate
> class to convert signal dataReadPrgress(int,int) to slot
> setValue(int) ?
Yes, but notice that the total value could change. You should update
the "maximum" property if the total changes. That means you need a slot
either way.
> What happens with dataReadPrgress if client tries to download file
>bigger than MAX(int) ?
You get Task 193474.
It overflows and wraps around from 2 GB to -2GB and counts up again.
>2. Could I pass through QVariant class that doesn't have constructor
>without parameters.
>It looks like
>
> Q_DECLARE_METATYPE ( someClass );
>
>require someClass to have someClass()
Q_DECLARE_METATYPE requires the type to have a default constructor, a copy
constructor, an assignment operator and a destructor. All public. The
type must behave like a POD type.
>
>3. Does code below
> qRegisterMetaType<QModelIndex>("QModelIndex") ;
>
> required to use QTableWidgetItem::setText() ?
No. You don't need meta types to make direct calls.
If you want to make use of a queued connection, then you must register the
types before use. As the documentation says.
>4. Does mutex around QScrollBar::setValue() is required. I got
>a lot of warnings about recursive repaint otherwise.
No, it's not required. There's only one thread that can access a
QScrollBar object, so there can be no threading issue.
--
[ signature omitted ]
Attachment:
signature.asc
Description: This is a digitally signed message part.
On Thursday 24 January 2008 23:16:49 Thiago Macieira wrote: > Dmitry Samersoff wrote: > >1. Could I connect QHttp directly to QProgressBar, without intermediate > > class to convert signal dataReadPrgress(int,int) to slot > > setValue(int) ? > > Yes, but notice that the total value could change. You should update > the "maximum" property if the total changes. That means you need a slot > either way. Also in the case where the file size is unknown (a common case) you want to set the progress bar to 0, 0 to get the special unknown behavior. So a slot is needed for that. -Benjamin Meyer -- [ signature omitted ]
On 25.01.08 00:42:53, Dmitry Samersoff wrote:
> Does anybody know:
Its better to ask unrelated questions in separate mails.
> 1. Could I connect QHttp directly to QProgressBar, without intermediate
> class to convert signal dataReadPrgress(int,int) to slot setValue(int) ?
That should work.
> What happens with dataReadPrgress if client tries to download file bigger
> than MAX(int) ?
Try it. I suspect on a 32 bit system you'll simply get a wrap-around for
files larger than 2GB.
> 2. Could I pass through QVariant class that doesn't have constructor
> without parameters.
No, as stated in the api docs of QMetaType.
> 3. Does code below
> qRegisterMetaType<QModelIndex>("QModelIndex") ;
>
> required to use QTableWidgetItem::setText() ?
No, QTableWidgetItem::setText() works without registering QModelIndex
with QVariant.
> 4. Does mutex around QScrollBar::setValue() is required. I got
> a lot of warnings about recursive repaint otherwise.
IIRC, that means you're issueing a paint event from inside a paint()
method (directly or indirectly). Thats not possible. Restructure your
code.
Andreas
--
[ signature omitted ]