patrik08
7th February 2007, 10:37
I have build a small html editor (to append on a CMS - CRM ) that load automatic image remote or local in to local Cache
and i enable drag in image or text/html text/plain and to edit all text attribute also table ...... but now i have problem on
image attribute width="xxx" height="xxx" ..
On Edit::RContext( const QPoint & pos ) (Contex menu) i grab QTextImageFormat from image i open Image_mod_Setting() on a
dialog and i edit image large height and save image and i send back QTextImageFormat and my problem ....
QTextImageFormat not write the new width="xxx" height="xxx" !!
On QTextTableFormat runn all ok and set all attribute correct padding bgcolor spacing ecc... and QTextImageFormat no! why?
void Edit::Image_mod_Setting()
{
/* QTextImageFormat nowimage; */
if (nowimage.isValid()) {
Edit_Image::self( this )->SetFormat(nowimage);
Edit_Image::self( this )->exec();
QTextImageFormat newforminepic = Edit_Image::self( this )->GetFormat();
if (newforminepic.isValid()) {
nowimage = newforminepic;
qDebug() << "### Draw image h ... " << nowimage.height();
qDebug() << "### Draw image w... " << nowimage.width();
}
}
}
void Edit::RContext( const QPoint & pos )
{
////////////////qDebug() << "### contextMenuEvent " << pos;
Eframe = false;
Eimage = false;
Etable = false;
QTextCursor findercursor(wtext->textCursor());
Eframe = findercursor.currentFrame();
nowimage = findercursor.charFormat().toImageFormat();
nowtable = findercursor.currentTable();
Eimage = nowimage.isValid();
Etable = findercursor.currentTable();
qDebug() << "### Eframe " << Eframe;
qDebug() << "### Eimage " << Eimage;
qDebug() << "### Etable " << Etable;
TContext = new QMenu(this);
if (editrun) {
TContext->addAction(tr( "View Modus" ), this , SLOT( ShowModusPanelView() ) );
TtableContext = new QMenu(tr("Table edit or new "),TContext);
TtableContext->addAction(tr( "Insert Table here" ), this , SLOT( CreateanewTable() ) );
if (findercursor.currentTable()) {
TtableContext->addAction(tr( "Table (this) Propriety BackgroundColor, Padding, Spacing" ), this , SLOT( TableSetting() ) );
TtableContext->addAction(tr( "Merge selected cell (if select)" ), this , SLOT( MergeCellByCursorPosition() ) );
TtableContext->addAction(tr( "Append Row on this table" ), this , SLOT( AppendTableRows() ) );
TtableContext->addAction(tr( "Append Cools on this table" ), this , SLOT( AppendTableCools() ) );
TtableContext->addAction(tr( "Remove this row" ), this , SLOT( RemoveRowByCursorPosition() ) );
TtableContext->addAction(tr( "Remove this cool" ), this , SLOT( RemoveCoolByCursorPosition() ) );
}
TContext->addAction(TtableContext->menuAction());
TimageContext = new QMenu(tr("Image edit or new "),TContext);
TimageContext->addAction(tr( "Insert new image" ), this , SLOT( CreateanewImage() ) );
if (Eimage) {
QString picname = nowimage.name();
QFileInfo locinfo(picname);
TimageContext->addAction(tr( "Image edit \"%1\" width - height" ).arg(locinfo.fileName()), this , SLOT( Image_mod_Setting() ) );
}
TContext->addAction(TimageContext->menuAction());
} else {
TContext->addAction(tr( "Edit Modus" ), this , SLOT( ShowModusPanelEdit() ) );
}
/* ..cute past & source view ecc........ */
and i enable drag in image or text/html text/plain and to edit all text attribute also table ...... but now i have problem on
image attribute width="xxx" height="xxx" ..
On Edit::RContext( const QPoint & pos ) (Contex menu) i grab QTextImageFormat from image i open Image_mod_Setting() on a
dialog and i edit image large height and save image and i send back QTextImageFormat and my problem ....
QTextImageFormat not write the new width="xxx" height="xxx" !!
On QTextTableFormat runn all ok and set all attribute correct padding bgcolor spacing ecc... and QTextImageFormat no! why?
void Edit::Image_mod_Setting()
{
/* QTextImageFormat nowimage; */
if (nowimage.isValid()) {
Edit_Image::self( this )->SetFormat(nowimage);
Edit_Image::self( this )->exec();
QTextImageFormat newforminepic = Edit_Image::self( this )->GetFormat();
if (newforminepic.isValid()) {
nowimage = newforminepic;
qDebug() << "### Draw image h ... " << nowimage.height();
qDebug() << "### Draw image w... " << nowimage.width();
}
}
}
void Edit::RContext( const QPoint & pos )
{
////////////////qDebug() << "### contextMenuEvent " << pos;
Eframe = false;
Eimage = false;
Etable = false;
QTextCursor findercursor(wtext->textCursor());
Eframe = findercursor.currentFrame();
nowimage = findercursor.charFormat().toImageFormat();
nowtable = findercursor.currentTable();
Eimage = nowimage.isValid();
Etable = findercursor.currentTable();
qDebug() << "### Eframe " << Eframe;
qDebug() << "### Eimage " << Eimage;
qDebug() << "### Etable " << Etable;
TContext = new QMenu(this);
if (editrun) {
TContext->addAction(tr( "View Modus" ), this , SLOT( ShowModusPanelView() ) );
TtableContext = new QMenu(tr("Table edit or new "),TContext);
TtableContext->addAction(tr( "Insert Table here" ), this , SLOT( CreateanewTable() ) );
if (findercursor.currentTable()) {
TtableContext->addAction(tr( "Table (this) Propriety BackgroundColor, Padding, Spacing" ), this , SLOT( TableSetting() ) );
TtableContext->addAction(tr( "Merge selected cell (if select)" ), this , SLOT( MergeCellByCursorPosition() ) );
TtableContext->addAction(tr( "Append Row on this table" ), this , SLOT( AppendTableRows() ) );
TtableContext->addAction(tr( "Append Cools on this table" ), this , SLOT( AppendTableCools() ) );
TtableContext->addAction(tr( "Remove this row" ), this , SLOT( RemoveRowByCursorPosition() ) );
TtableContext->addAction(tr( "Remove this cool" ), this , SLOT( RemoveCoolByCursorPosition() ) );
}
TContext->addAction(TtableContext->menuAction());
TimageContext = new QMenu(tr("Image edit or new "),TContext);
TimageContext->addAction(tr( "Insert new image" ), this , SLOT( CreateanewImage() ) );
if (Eimage) {
QString picname = nowimage.name();
QFileInfo locinfo(picname);
TimageContext->addAction(tr( "Image edit \"%1\" width - height" ).arg(locinfo.fileName()), this , SLOT( Image_mod_Setting() ) );
}
TContext->addAction(TimageContext->menuAction());
} else {
TContext->addAction(tr( "Edit Modus" ), this , SLOT( ShowModusPanelEdit() ) );
}
/* ..cute past & source view ecc........ */