Bug 176266 - notes plasmoid: text color won't change
Summary: notes plasmoid: text color won't change
Status: RESOLVED FIXED
Alias: None
Product: plasma4
Classification: Plasma
Component: widget-notes (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-11-27 21:16 UTC by Alexander Rössler
Modified: 2009-08-22 20:09 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Rössler 2008-11-27 21:16:09 UTC
Version:           4.1.80 (using Devel)
OS:                Linux
Installed from:    Compiled sources

The text color of the notes plasmoid won't change after setting it to a custom color, it always uses the default plasma color.
Comment 1 Anne-Marie Mahfouf 2008-12-06 11:38:13 UTC
In trunk this bug still exists when you change color BEFORE writing any text.

If you write some text then change color, the new color is applied.
If you don't have any text and set a custom color, it is not applied.

It might be a QGraphicsProxyWidget bug as the paint event gives me the new color.
Comment 2 Anne-Marie Mahfouf 2008-12-06 16:01:53 UTC
I have a test case for it: I made a minimum app with a QTextEdit and below it, a QTextEdit as QGraphicsProxyWidget.
Both are without any text, both have setTextColor(QColor(Qt::red)); set. Enter some text in both, top one (normal QTextEdit) has text in red, WoC stays with text black.

To build: qmake -project && qmake && make

#include <QApplication>

#include <QVBoxLayout>
#include <QGraphicsScene>
#include <QGraphicsView>
#include <QGraphicsProxyWidget>
#include <QTextEdit>

int main( int argc, char ** argv )
{

    QApplication a( argc, argv );
    QWidget window;
    window.resize(400, 250);
    //normal QTextEdit
    QVBoxLayout *layout = new QVBoxLayout;
    QTextEdit *textWidget1 = new QTextEdit;
    layout->addWidget(textWidget1);
    textWidget1->setTextColor(QColor(Qt::red));
    // ** input some text it'll be red
    //QtextEdit with WoC
    QTextEdit *textWidget2 = new QTextEdit;
    QGraphicsView *view  = new QGraphicsView;
    QGraphicsScene *scene = new QGraphicsScene;
    view->setScene(scene);
    QGraphicsProxyWidget *proxy = scene->addWidget(textWidget2);
    textWidget2->setTextColor(QColor(Qt::red));
    // ** input some text, it'll stay black
    layout->addWidget(view);
    textWidget1->show();
    window.setLayout(layout);
    view->show();

    window.show();

    return a.exec();
}


Comment 3 Antonio Vinci 2008-12-07 15:47:14 UTC
It's a bit worse... If you change color after writing text, and then delete all text, it returns black.
Comment 4 Anne-Marie Mahfouf 2008-12-08 07:46:10 UTC
I think it's the same text case than the one above: setTextColor() is not applied in the WoC when there is no text.
Comment 5 Anne-Marie Mahfouf 2009-05-09 13:41:55 UTC
The bug is fixed upstream but this doesnot work yet on the plasmoid.
Attempted patch at http://reviewboard.kde.org/r/679/
A bit ugly but the timer has to be skipped for it to work.
Comment 6 Dario Andres 2009-08-22 18:45:47 UTC
SVN commit 1014374 by darioandres:

- When the text is deleted the format will always reverted to zero; as KTextEdit calls only work on
  local/selected text, but they won't set a "default" format.
  - To fix this, I adapted the patch by anmma at http://reviewboard.kde.org/r/679/
    - On "lineChange", detect if the character entered is the first one
      (that means the previous text (if any) was deleted) and set the default char text format
      to use the defined font style/size/family and foreground color.
  So, the global format/style settings will be always honored

- Do not change the QPalette of the KTextEdit as this is not needed anymore (was it needed before?)

BUG: 176266


 M  +8 -6      notes.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1014374
Comment 7 Dario Andres 2009-08-22 20:09:02 UTC
SVN commit 1014389 by darioandres:

Backport to 4.3 of:
SVN commit 1014374 by darioandres:

- When the text is deleted the format will always reverted to zero; as
KTextEdit calls only work on
  local/selected text, but they won't set a "default" format.
  - To fix this, I adapted the patch by anmma at
http://reviewboard.kde.org/r/679/
    - On "lineChange", detect if the character entered is the first one
      (that means the previous text (if any) was deleted) and set the default
char text format
      to use the defined font style/size/family and foreground color.
  So, the global format/style settings will be always honored

- Do not change the QPalette of the KTextEdit as this is not needed anymore
(was it needed before?)

and:
SVN commit 1014384 by darioandres:

- Simplify the code to selectAll+change some text property

- On "updateTextGeometry" it is not necessary to set the font family again.
  - Set the font family only on "configAccepted" (if the font was changed)

- Fix a bug in the following workflow:
  - Text written, deleted, widget resized, text written again will have the previous size
  (calculated before the "updateTextGeometry" call). That is why we need to call "lineChanged" again

CCBUG: 176266


 M  +18 -21    notes.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1014389