Dear Marin,
I altered TreeViewDragDrop.C in the treeview-dragdrop example (wt-2.99.5) in
order to demonstrate this,
I attached a diff to this mail.
Kind regards,
Pieter
2009/10/13 Marin Lukovic <[email protected]>
> Dear Pieter,
>
> Thank you vary much for help.
>
> Yes, I'm using WStandardItemDelegate with an url.
>
> Like you suggested, I created a CustomAbstractItemDelegate which inherited
> WAbstractItemDelegate, but I cannot find any WAnchor virtual function in
> WAbstractItemDelegate,
> nor in parameter members of existing viturtual funs, nor in WObject.
>
> Anyway, I created AnchorTarget WAnchor(); which returns
> AnchorTarget::TargetNewWindow,
> but it wont work, and I loose all labels from targeting WTreeView column.
>
> I stuck, please help.
>
> Best regards,
> Marin.
>
>
>
> "Pieter Libin" <[email protected]> wrote in message
> news:[email protected]...
> Dear Marin,
>
> Do you mean you're using WStandardItems with an url in your model?
>
> If this is the case, you can make a custom implementation of
> WAbstractItemDelegate,
> so it returns a WAnchor with AnchorTarget::TargetNewWindow set.
> You can use this custom WAbstractItemDelegate implementation by using
> WTreeView::setItemDelegateForColumn() or WTreeView::setItemDelegate().
> **
> kind regards,
>
> Pieter
>
>
> On Mon, Oct 12, 2009 at 3:58 PM, Marin Lukovic <[email protected]>wrote:
>
>> Hello,
>>
>>
>>
>> I'm using WtreeView widget with WStandardItemModel and WstandardItem.
>>
>> Does anyone know how to make that url from WstandardItem opens in new
>> window/tab instead in active window?
>>
>>
>>
>> Thank you very much,
>>
>> Marin.
>>
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>> is the only developer event you need to attend this year. Jumpstart your
>> developing skills, take BlackBerry mobile applications to market and stay
>> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
>> http://p.sf.net/sfu/devconference
>> _______________________________________________
>> witty-interest mailing list
>> [email protected]<[email protected]>
>> https://lists.sourceforge.net/lists/listinfo/witty-interest
>>
>
> ------------------------------
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
>
> ------------------------------
>
> _______________________________________________
> witty-interest mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/witty-interest
>
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> witty-interest mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/witty-interest
>
>
30,31d29
< #include <Wt/WAnchor>
< #include <Wt/WAbstractItemDelegate>
76,102d73
< class UrlItemDelegate : public WAbstractItemDelegate {
< public:
< UrlItemDelegate(WObject *parent = 0)
< : WAbstractItemDelegate(parent)
< { }
<
< WWidget *update(WWidget *widget, const WModelIndex& index,
< WFlags<ViewItemRenderFlag> flags)
< {
< WAnchor *a;
<
< if (widget) {
< a = dynamic_cast<WAnchor *>(widget);
< } else {
< a = new WAnchor();
< widget = a;
< }
<
< boost::any url = index.data(UrlRole);
< a->setTarget(TargetNewWindow);
< a->setRef(asString(url).toUTF8());
< a->setText(asString(index.data(DisplayRole)));
<
< return widget;
< }
< };
<
419d389
< treeView->setColumnWidth(6, 100);
426,428d395
< UrlItemDelegate *urlDelegate = new UrlItemDelegate(this);
< treeView->setItemDelegateForColumn(6, urlDelegate);
<
593,597d559
<
< WStandardItem* url = new WStandardItem();
< url->setUrl("http://www.google.be");
< url->setText("www.google.be");
< fileModel_->setItem(i, 6, url);
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest