c++ - Show status bar a default message -


i have created status bar in qt. developing webbrowser. when user hovers link status bar shows link hovered.

all ok, want set default text when status bar blank.

is there option this?

i beginner :)

if connect linkhovered signal of qwebpage statusbar, can't check whether empty , display whatever message like?

the code below seems describe, maybe misunderstood asking? note: created qmainwindow has status bar default.

#ifndef mymainwindow_h #define mymainwindow_h  #include <qmainwindow>  #include "ui_mainwindow.h"  class mainwindow: public qmainwindow, private ui::mainwindow {   q_object    public:   mainwindow(qwidget *parent = 0) : qmainwindow(parent), defaultmessage("default message")  {     setupui(this);     webview->load(qurl("http://www.stackoverflow.com"));     this->statusbar()->showmessage(defaultmessage);     connect(webview->page(),signal(linkhovered(const qstring & , const qstring & , const qstring & )),             this, slot( hovered(const qstring & , const qstring & , const qstring & ) ) );   }    public slots:    void hovered(const qstring & link, const qstring & title, const qstring & textcontent) {     this->statusbar()->showmessage(link == "" ?  defaultmessage : link);   }   private:   qstring defaultmessage;  };  #endif 

let me know if helps.


Comments