Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-106280

QTextFormat setProperty(QTextFormat::***Margin, qreal) dosen't convert type.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 6.3.0
    • GUI: Text handling
    • None
    • All

    Description

      #include "mainwindow.h"
      #include "qtextedit.h"
      #include "qtextdocument.h"
      
      #include <QTextFrame>
      #include <QTextFrameFormat>
      
      MainWindow::MainWindow(QWidget *parent)
          : QMainWindow(parent)
      {
      
          textedit = new QTextEdit;
          setCentralWidget(textedit);
      
          QTextDocument *doc = textedit->document();
          QTextFrame *rootFrame = doc->rootFrame();
          QTextFrameFormat rootFrameFormat = rootFrame->frameFormat();
          /* 50.0, 30.0 have no problem*/
          rootFrameFormat.setProperty(QTextFrameFormat::FrameLeftMargin, 50);
          rootFrameFormat.setProperty(QTextFrameFormat::FrameTopMargin, 30);
          rootFrame->setFrameFormat(rootFrameFormat);
      
          /* 50.0, 50 , both of them are okay */
          rootFrameFormat.setLeftMargin(50);
          rootFrame->setFrameFormat(rootFrameFormat);
          }
      
      MainWindow::~MainWindow()
      {
      }
      

      If I set margin by setProperty, I must adjust the type to real.
      On the other hand, if I set margin by setLeftMargin , int object is converted.
      I think this is not a bug, but it has no consistency.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            nori Harunori Fujimoto
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes