hickscorp
6th December 2006, 20:54
Hello people,
i'm new to this forum, i don't know how much active it is.
So let me explain what i'm doing first:
- I want to achieve a very simple text editor (Tab based) like GEdit is.
- I want it to be light (Because it is part of a much bigger project i have).
So for this
- In the first tab i have a QTextEdit item.
- i have created a simple QT Window, with in it a tabContainer.
- In this tab container, i have created two test tabs (tabFile_New1 and tabFile_New2).
- The signal fom the tab container: currentChanged(QWidget*) is handled in my main Window code, and it pretty much does something like this:
void CWndMainImpl::EditorTabChanged (QWidget* pWidget) {
QTabWidget* pSelectedTab = (QTabWidget*)pWidget;
pTextViewer->setParent(pSelectedTab);
}
So as you understood, the goal is to only have one single text edit box which travels from one tab to another, just changing it's content in a transparent way to the end user...
The problem is that when i run the app and then switch from the default tab (Where there is actually the text edit) to the other tab, it doesn't switches. And then when i go back to the original tab, my text edit isn't there anymore...
I have tried very much variants and i don't finally understand what i am doing wrong.
Thanks for your time!
Pierre.
[EDIT:] Sorry for my bad english
i'm new to this forum, i don't know how much active it is.
So let me explain what i'm doing first:
- I want to achieve a very simple text editor (Tab based) like GEdit is.
- I want it to be light (Because it is part of a much bigger project i have).
So for this
- In the first tab i have a QTextEdit item.
- i have created a simple QT Window, with in it a tabContainer.
- In this tab container, i have created two test tabs (tabFile_New1 and tabFile_New2).
- The signal fom the tab container: currentChanged(QWidget*) is handled in my main Window code, and it pretty much does something like this:
void CWndMainImpl::EditorTabChanged (QWidget* pWidget) {
QTabWidget* pSelectedTab = (QTabWidget*)pWidget;
pTextViewer->setParent(pSelectedTab);
}
So as you understood, the goal is to only have one single text edit box which travels from one tab to another, just changing it's content in a transparent way to the end user...
The problem is that when i run the app and then switch from the default tab (Where there is actually the text edit) to the other tab, it doesn't switches. And then when i go back to the original tab, my text edit isn't there anymore...
I have tried very much variants and i don't finally understand what i am doing wrong.
Thanks for your time!
Pierre.
[EDIT:] Sorry for my bad english