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. QQueue peek ?
Forum Update on Monday, May 27th 2025

QQueue peek ?

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 325 Views
  • 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.
  • SPlattenS Offline
    SPlattenS Offline
    SPlatten
    wrote on last edited by
    #1

    I am using QQueue:

    typedef QQueue<QJsonObject> mqueJSON;
    

    Presently I am using dequeue to extract an item from the queue, however what I really want to do is peek at the queue and not remove an item from its position in the queue until I want to remove it.

    Is there any way to do this?

    Kind Regards,
    Sy

    J.HilkJ 1 Reply Last reply
    0
    • SPlattenS SPlatten

      I am using QQueue:

      typedef QQueue<QJsonObject> mqueJSON;
      

      Presently I am using dequeue to extract an item from the queue, however what I really want to do is peek at the queue and not remove an item from its position in the queue until I want to remove it.

      Is there any way to do this?

      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by
      #2

      https://doc.qt.io/qt-5/qqueue.html#head

      if(!mqueJSON.isEmpty()){
           const auto peekItem = mqueJSON.head();
           ...
      }
      

      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      SPlattenS 1 Reply Last reply
      6
      • J.HilkJ J.Hilk

        https://doc.qt.io/qt-5/qqueue.html#head

        if(!mqueJSON.isEmpty()){
             const auto peekItem = mqueJSON.head();
             ...
        }
        
        SPlattenS Offline
        SPlattenS Offline
        SPlatten
        wrote on last edited by
        #3

        @J-Hilk , thank you.

        Kind Regards,
        Sy

        1 Reply Last reply
        0
        • Christian EhrlicherC Online
          Christian EhrlicherC Online
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Reading the documentation is really hard...

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          2

          • Login

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