CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1
  1. #1
    Join Date
    Apr 2017
    Posts
    6

    Question_QWidget

    I have a question about using the QlistWidget Function where to use it to check if it is listed before and if not it should written into the listwdget.
    I have prepared some code but it doesnt work properly. Can someone look and correct if possible ?

    Thanks in advance,

    The part of the code (also included as txt file)
    -----------------------------------------------------------------------------

    Code:
    //der Slot für das Laden der Seite
    void MainWindow::on_webView_loadFinished(bool ok)
    {
        int n;
        //für die HistoryListe
        QWebHistory *meineHistory = ui->webView->history();
        QListWidget *meineListe = new QListWidget(this);
        n=ui->listWidget->count();
    
        //war das Laden erfolgreich?
        if (ok)
        {
    
           {
    
                if ((ui->webView->url().toString()).isEmpty()==false)
                    {
                    for (int i=0; i<= n;i++)
                    // Prüfen ob die geladene Seite schon vorhanden ist
                    ui->listWidget->findItems(ui->webView->url().toString(),Qt::MatchFixedString);
                    // wenn die Seite noch nicht vorhanden ist
                    if (Qt::MatchFixedString ==8)
                    // die URL in das Listenfeld schreiben
                    ui->listWidget->addItem(ui->webView->url().toString());
                    }
    
                    else
                    {
                    //und auch in das Eingabefeld
                    adressFeld->setText(ui->webView->url().toString());
                    //den Titel setzen
                    this->setWindowTitle("Minibrowser - " + ui->webView->title());
                    if (meineHistory->canGoBack())
                        ui->action_R_ckw_rts->setEnabled(true);
                    else
                        ui->action_R_ckw_rts->setEnabled(false);
                    if (meineHistory->canGoForward())
                        ui->action_Vorw_rts->setEnabled(true);
                    else
                        ui->action_Vorw_rts->setEnabled(false);
                    }
          }
        }
    
    
        //die Fortschrittsanzeige ausblenden
        fortschrittBalken->setVisible(false);
        //den Text ändern
        fortschrittLabel->setText("Seite geladen");
    ---------------------------------------------------------
    Attached Files Attached Files
    Last edited by 2kaud; September 17th, 2017 at 10:13 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured