Qt-interest Archive, June 2007
Hi all, is it possible to change at runtime the traslator on qt-4.1.0?
Message 1 in thread
If yes, how is it possible; where can I find infos?
P.S.
I tried to follwn the instructions of QTraslator doc, but it does not work
Regards
--
[ signature omitted ]
Message 2 in thread
Hello Fabio,
yes it is possible. But it is not quite easy.
You have to call retranslateUi() on all currently visible dialogs and
windows of your application.
Regards,
Falko
Fabio Giovagnini schrieb:
> If yes, how is it possible; where can I find infos?
>
> P.S.
>
> I tried to follwn the instructions of QTraslator doc, but it does not work
>
> Regards
>
>
--
[ signature omitted ]
Message 3 in thread
Thanks a lot.
It works.
Regards
Alle 13:34, martedì 5 giugno 2007, Falko Buttler ha scritto:
> retranslateUi()
--
[ signature omitted ]
Message 4 in thread
Hi, Fabio,
Perhaps you can read "17. Internationalization" Chapter, "Dynamic
Language Switching" Section in the C++ GUI Programming with Qt 4.
Regards,
Liang
--
[ signature omitted ]
Message 5 in thread
Hi,
my first qslitview and I don't understand how to customize the item
drawing when no edited.
I need to display a color item in llistview.
an icon filled with color and on his right side the color values
I rewrite the pain of attributeitemdelegate class.
I call drawDecoration (painter, option, option.rect,lPixmap );
and then call drawDisplay(painter, option,option.rect, text);
but the result is that the text is left aligned and icon is centered.
I would like to draw icon on left poart of cell and on his right side
the text.
What may I manipulate to change the default result?
the rect?
I see that option parameter give some infos about icon alignment but
don't see how to control it.
can someone help me to understand or point the right page in MVC doc please?
void VrQAttributeItemDelegate::paint(QPainter *painter, const
QStyleOptionViewItem &option, const QModelIndex &index) const
{
if(index.column() == 1 )
{
QString text;
QPixmap lPixmap;
VrFieldItem *item =
static_cast<VrFieldItem*>(index.internalPointer());
//Test if it's in display mode else no text must appears
//if(index.model()->data(index, Qt::DisplayRole
if( msEditorMap.contains(
item->value().getRTTIType().raw_name() ) )
{
text = msEditorMap.value(
item->value().getRTTIType().raw_name() )->getText(item);
lPixmap = msEditorMap.value(
item->value().getRTTIType().raw_name() )->getPixmap(item);
}
else
{
//default LineEdit
text = msEditorMap.value( typeid(std::string).raw_name()
)->getText(item);
}
*//HERE I ADD PIXMAP filled with color*
if
(NOT lPixmap.isNull())
{
* drawDecoration (painter, option, option.rect,lPixmap );*
}
*//AND I DRAW TEXT (RED, GREEN BLUE VALUES
drawDisplay(painter, option,option.rect, text);*
drawFocus(painter, option, option.rect);
}
else
{
QItemDelegate::paint(painter, option, index);
}
}
Message 6 in thread
I think you might be able to solve most of this by overriding the models
data method.
Take a look at the enum Qt::ItemDataRole (in the qt.html doc) and you
will see you can change alignment, decoration role, and a bunch of other
attributes for display
Scott
________________________________
From: veronique.lefrere@xxxxxx [mailto:veronique.lefrere@xxxxxx]
Sent: Tuesday, June 05, 2007 9:25 AM
To: qt-interest@xxxxxxxxxxxxx
Subject: redrawing the attibute item in a qlistview - with Qt 4.2.2 (but
soon 4.3...)
Hi,
my first qslitview and I don't understand how to customize the item
drawing when no edited.
I need to display a color item in llistview.
an icon filled with color and on his right side the color values
I rewrite the pain of attributeitemdelegate class.
I call drawDecoration (painter, option, option.rect,lPixmap );
and then call drawDisplay(painter, option,option.rect, text);
but the result is that the text is left aligned and icon is centered.
I would like to draw icon on left poart of cell and on his right side
the text.
What may I manipulate to change the default result?
the rect?
I see that option parameter give some infos about icon alignment but
don't see how to control it.
can someone help me to understand or point the right page in MVC doc
please?
void VrQAttributeItemDelegate::paint(QPainter *painter, const
QStyleOptionViewItem &option, const QModelIndex &index) const
{
if(index.column() == 1 )
{
QString text;
QPixmap lPixmap;
VrFieldItem *item =
static_cast<VrFieldItem*>(index.internalPointer());
//Test if it's in display mode else no text must appears
//if(index.model()->data(index, Qt::DisplayRole
if( msEditorMap.contains(
item->value().getRTTIType().raw_name() ) )
{
text = msEditorMap.value(
item->value().getRTTIType().raw_name() )->getText(item);
lPixmap = msEditorMap.value(
item->value().getRTTIType().raw_name() )->getPixmap(item);
}
else
{
//default LineEdit
text = msEditorMap.value( typeid(std::string).raw_name()
)->getText(item);
}
//HERE I ADD PIXMAP filled with color
if
(NOT lPixmap.isNull())
{
drawDecoration (painter, option, option.rect,lPixmap );
}
//AND I DRAW TEXT (RED, GREEN BLUE VALUES
drawDisplay(painter, option,option.rect, text);
drawFocus(painter, option, option.rect);
}
else
{
QItemDelegate::paint(painter, option, index);
}
}
Message 7 in thread
Yes I did it, but I ignored retraslationUi() function being a member of Ui and
not if Internationalization classes.
Thanks a lot for you answer; I risolved with:
Hello Fabio,
yes it is possible. But it is not quite easy.
You have to call retranslateUi() on all currently visible dialogs and
windows of your application.
Regards,
Falko
being Falko answer.
Thanks again.
Alle 15:26, martedà 5 giugno 2007, Liang Qi ha scritto:
> Hi, Fabio,
>
> Perhaps you can read "17. Internationalization" Chapter, "Dynamic
> Language Switching" Section in the C++ GUI Programming with Qt 4.
>
> Regards,
> Liang
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body. List archive and information:
> http://lists.trolltech.com/qt-interest/
--
[ signature omitted ]