[Qt-creator] Core::EditorManagerPlaceHolder::current() method replacement in Qt Creator 3.0
Xiaofeng Wu
djangowu at gmail.com
Tue Mar 4 16:03:07 CET 2014
I try the method you told me. The code is like the following
bool EditorTabsPlugin::eventFilter(QObject *obj, QEvent *event)
{
if (event->type() == QEvent::ParentChange) {
Core::EditorManager* manager = Core::EditorManager::instance();
Core::EditorManagerPlaceHolder* placeHolder =
static_cast<Core::EditorManagerPlaceHolder*>(manager->parent());
placeHolder->layout()->addWidget(bar);
}
return false;
}
The result is that it creates another window and put the widget in it
instead of placing the widget on top of the editor panel.
Where is the problem?
On Thu, Feb 20, 2014 at 9:21 AM, Ziller Eike <Eike.Ziller at digia.com> wrote:
>
> On Feb 20, 2014, at 2:37 PM, Xiaofeng Wu <djangowu at gmail.com> wrote:
>
> > Hi,
>
> Hi, please do not send the same email multiple times.
>
> > I only want the tabs to show up in the main window, so what you said is
> not a problem to me.
> >
> > I understand that I can "take EditorManager::instance(), install
> yourself as an event filter" so that if the instance()'s parent changes, my
> code will know that.
> > But, when it happens, what is the code look like if I want to add a
> QTabWidget on top of the editor panel?
>
> you get the parent of EditorManager::instance(), if that is not 0, it is
> the EditorManagerPlaceHolder instance like before.
>
> Br, Eike
>
> > On Wed, Feb 19, 2014 at 10:22 AM, Ziller Eike <Eike.Ziller at digia.com>
> wrote:
> > Hi,
> >
> > I suppose you could take EditorManager::instance(), install yourself as
> an event filter, and do whatever magic on ParentChange events.
> >
> > Note that both your old method, and anything based on the parent of
> EditorManager::instance(), does not work with additional editor windows
> (Window > Open in New Window).
> >
> > Br, Eike
> >
> > On Feb 19, 2014, at 3:25 PM, Xiaofeng Wu <djangowu at gmail.com> wrote:
> >
> > > I am developing a Qt Creator plugin. This plugin shows currently
> opened files as a QTabWidget on top of the editor pane. In Qt Creator 2.8,
> the code works like the following,
> > > Core::EditorManagerPlaceHolder* holder =
> Core::EditorManagerPlaceHolder::current();
> > > holder->layout()->addWidget(myTabWidget);
> > >
> > > Here is the screen shot for the plugin running in Qt Creator 2.8
> > >
> > > <1.png>
> > >
> > > However, in Qt Creator 3.0, the method
> Core::EditorManagerPlaceHolder::current() no longer exists. In this
> situation how am I able to put the QTabWidget on the top the editor window
> > > _______________________________________________
> > > Qt-creator mailing list
> > > Qt-creator at qt-project.org
> > > http://lists.qt-project.org/mailman/listinfo/qt-creator
> >
> > --
> > Eike Ziller, Senior Software Engineer - Digia, Qt
> >
> > Digia Germany GmbH, Rudower Chaussee 13, D-12489 Berlin
> > Geschäftsführer: Mika Pälsi, Juha Varelius, Tuula Haataja
> > Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht
> Charlottenburg, HRB 144331 B
> >
> >
> > _______________________________________________
> > Qt-creator mailing list
> > Qt-creator at qt-project.org
> > http://lists.qt-project.org/mailman/listinfo/qt-creator
>
> --
> Eike Ziller, Senior Software Engineer - Digia, Qt
>
> Digia Germany GmbH, Rudower Chaussee 13, D-12489 Berlin
> Geschäftsführer: Mika Pälsi, Juha Varelius, Tuula Haataja
> Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht
> Charlottenburg, HRB 144331 B
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qt-creator/attachments/20140304/8955549c/attachment.html>
More information about the Qt-creator
mailing list