I build a small xhtml editor.... start point is QTextEdit
to discovery the objekt QTextTable is easy and i can make context menu to chance cellpadding spacing background color widht and so....
QTextTable * QTextCursor::currentTable () const
Returns a pointer to the current table if the cursor position() is inside a block that is part of a table; otherwise returns 0.
Now i like to discovery QTextImageFormat objekt to chance hight widht name ... how i find a pointer ?...
/* QTextEdit *html_area; */
connect(html_area, SIGNAL(cursorPositionChanged()),this , SLOT(WakeUpCursor()));
void Html_Editor::WakeUpCursor()
{
if (!findercursor.isNull()) {
/* discovery if a table is selected to display CustomContextMenu start */
if (findercursor.currentTable()) { /* !=0 */
worktable = true;
existingtable = findercursor.currentTable(); /* (header) QTextTable *existingtable; */
SetupTable();
html_area->setContextMenuPolicy( Qt::CustomContextMenu );
connect(html_area ,
SIGNAL( customContextMenuRequested
( const QPoint & ) ),
this,
SLOT( TableContexMenu
() ) );
} else {
ResetTableContex(); /* disconnect remove table context menu and work table false */
}
/* discovery if a table is selected to display CustomContextMenu end */
/* discovery?? #include <QTextImageFormat>*/
}
}
/* QTextEdit *html_area; */
connect(html_area, SIGNAL(cursorPositionChanged()),this , SLOT(WakeUpCursor()));
void Html_Editor::WakeUpCursor()
{
QTextCursor findercursor(html_area->textCursor());
if (!findercursor.isNull()) {
/* discovery if a table is selected to display CustomContextMenu start */
if (findercursor.currentTable()) { /* !=0 */
worktable = true;
existingtable = findercursor.currentTable(); /* (header) QTextTable *existingtable; */
SetupTable();
html_area->setContextMenuPolicy( Qt::CustomContextMenu );
connect(html_area , SIGNAL( customContextMenuRequested( const QPoint & ) ), this, SLOT( TableContexMenu() ) );
} else {
ResetTableContex(); /* disconnect remove table context menu and work table false */
}
/* discovery if a table is selected to display CustomContextMenu end */
/* discovery?? #include <QTextImageFormat>*/
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks