[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: Getting QWidget of GTK window?
From:       Taj Morton <taj-kde () wildgardenseed ! com>
Date:       2004-09-12 16:05:54
Message-ID: 414473E2.4090005 () wildgardenseed ! com
[Download RAW message or body]

>
>
>>It is apparent that QWidget::find(xid) is returning 0, as the docs say
>>"If there is no widget with this identifier, 0 is returned."
>>So, is there anyway to get a QWidget of a GTK window... If not, is there
>>another workaround that will allow me to give getOpenFileName
>>instructions to have a GTK window as a parent?
>>    
>>
>
> You can use XSetTransientFor() to set the parent relationship directly. If 
>you cannot access the dialog widget itself, you may use a hack like the one 
>in kdebase/kdialog (alternatively KFileDialog could get overloads that'd 
>accept WId instead of QWidget*).
>  
>
Thanks, I reimplemented KFileDialog::getOpenFileName and it works great! 
My only problem is that ops->clearHistory() is protected. Thus, I can't 
call it. I have this:

QString getOpenFileNameWId(const QString& startDir,
                                     const QString& filter,
                                     WId parent_id, const QString& caption)
{
    KFileDialog dlg(startDir, filter, 0, "filedialog", true);
    XSetTransientForHint( qt_xdisplay(), dlg.winId(), parent_id );

    dlg.setOperationMode( KFileDialog::Opening );

    dlg.setMode( KFile::File | KFile::LocalOnly );
    dlg.setCaption(caption.isNull() ? i18n("Open") : caption);

    //dlg.ops->clearHistory();
    dlg.exec();

    return dlg.selectedFile();
}

Is there a workaround to dlg.ops->clearHistory(), or is it really 
required to call clearHistory()?

-- 
Taj
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic