Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to properly size QWebView?
Forum Updated to NodeBB v4.3 + New Features

How to properly size QWebView?

Scheduled Pinned Locked Moved General and Desktop
12 Posts 3 Posters 11.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    chacham15
    wrote on last edited by
    #3

    The thing is that what is being rendered is not the internet, but rather emails which are formatted using html (therefore, there is no navigation). Also the reason that I want to resize the email whenever the size of the window changes.

    1 Reply Last reply
    0
    • P Offline
      P Offline
      Peppy
      wrote on last edited by
      #4

      eh. What?
      You want to fix window size to size of webpage? Why?

      You can write something like:

      @
      //...
      QWebView *view;
      QMainWindow *window = new QMainWindow();
      window->setCentralWidget(view);
      window->show();
      @

      Or use some layout:
      @
      //...
      QWidget window = new QWidget();
      QLayout
      layout = new QLayout();
      QWebView* view = new QWebView();

      layout->addWidget(view);
      window->setLayout(layout);
      window->show();
      @

      This will keep your WebView expanding

      1 Reply Last reply
      0
      • C Offline
        C Offline
        chacham15
        wrote on last edited by
        #5

        peppy, I want to render an email in the smallest height possible for a given width (the width of the window) so that scroll bars are avoided. The first example does not attempt to limit the height of the widget, and the second does not work because it relies on sizeHint being accurate, which it isnt.

        1 Reply Last reply
        0
        • P Offline
          P Offline
          Peppy
          wrote on last edited by
          #6

          The smallest height as possible? The smallest height as possible depends on that current website, how is done, isn't it?

          1 Reply Last reply
          0
          • C Offline
            C Offline
            chacham15
            wrote on last edited by
            #7

            yes, the smallest height possible does depend on the html, hence the problem

            1 Reply Last reply
            0
            • C Offline
              C Offline
              chacham15
              wrote on last edited by
              #8

              The solution I ended up going with is implementing heightForWidth (see the new question)

              1 Reply Last reply
              0
              • P Offline
                P Offline
                Peppy
                wrote on last edited by
                #9

                And what will you app do, if my site is higher than screen of some user?

                1 Reply Last reply
                0
                • C Offline
                  C Offline
                  chacham15
                  wrote on last edited by
                  #10

                  QResizingWebView will be contained by a QScrollArea

                  1 Reply Last reply
                  0
                  • C Offline
                    C Offline
                    ChrisW67
                    wrote on last edited by
                    #11

                    So you go out of your way to avoid the scroll bars that are naturally provided by QWebView when they are needed, only to wrap the whole thing in a QScrollArea so that you get scroll bars when you need them. Colour me confused.

                    1 Reply Last reply
                    0
                    • C Offline
                      C Offline
                      chacham15
                      wrote on last edited by
                      #12

                      I know this has been a while, but essentially what I wanted to do here was to mix htmlviews and widgets into one scrolling view. Therefore, each element inside the scrolling view has to always be at its full size. Does that make sense?

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved