Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QTableView / QTableWidget #17

Closed
5k3105 opened this issue Apr 7, 2016 · 13 comments
Closed

QTableView / QTableWidget #17

5k3105 opened this issue Apr 7, 2016 · 13 comments

Comments

@5k3105
Copy link
Contributor

5k3105 commented Apr 7, 2016

Hello,

Do you have plans to implement these?

Currently NewQTableViewFromPointer / NewQTableWidgetFromPointer exist.

Also, gui.NewQPixmap?

Thanks.

@therecipe
Copy link
Owner

Hey

Yes, I will look into this.
So, that these will come along with the update to qt 5.6.

@5k3105
Copy link
Contributor Author

5k3105 commented Apr 12, 2016

That sounds great. Thanks.

@therecipe
Copy link
Owner

They are implemented :)
I pushed the changes earlier, because the update to 5.6 will take a little longer.

@5k3105
Copy link
Contributor Author

5k3105 commented Apr 12, 2016

Oh wow! That was quick. I'll test it out asap.

Is there a way to donate to the project?

@therecipe
Copy link
Owner

Thank you for the offer, I appreciate it.
But there is no need to donate :)

@5k3105
Copy link
Contributor Author

5k3105 commented Apr 13, 2016

I haven't asked you to implement Qt WebEngine yet though :) Maybe then you will reconsider?

@5k3105
Copy link
Contributor Author

5k3105 commented Apr 14, 2016

Hi -

Testing out pixmap. First version (below) works. Second version attempting to include '.tiff' format using QImageReader (ex ref http://blog.elangroup-software.com/2015/09/qimagereader-how-to-use-and-whats-new.html) I can't find a Read method that returns a QImage. Also, in NewQImageReader3 the second parameter asks for 'format core.QByteArray_ITF' yet (ref http://doc.qt.io/qt-5/qimagereader.html#format) the format method returns what looks like a string.

Thanks

    func TreeViewCurrentChanged(current *core.QModelIndex, previous *core.QModelIndex) {
        FileName := FsModel.FileName(current)
        FilePath := FsModel.FilePath(current)

        FsTreeView.ScrollTo(current, 0) // 0 = Ensure Visible, 3 = PositionAtCenter

        statusbar.ShowMessage(FilePath, 0)

        s := strings.ToLower(path.Ext(FileName))

        switch s {
        case ".png", ".jpg":
            pix := gui.NewQPixmap4(FilePath, "", 0)

            scene.AddPixmap(pix)
            view.SetScene(scene)
            view.Show()

        default:
            scene.Clear()
            view.SetScene(scene)
            view.Show()
        }

    }


    func TreeViewCurrentChanged(current *core.QModelIndex, previous *core.QModelIndex) {
        FileName := FsModel.FileName(current)
        FilePath := FsModel.FilePath(current)

        FsTreeView.ScrollTo(current, 0) // 0 = Ensure Visible, 3 = PositionAtCenter

        statusbar.ShowMessage(FilePath, 0)

        s := strings.ToLower(path.Ext(FileName))
        f := strings.TrimLeft(s, ".")

        switch s {
        case ".png", ".jpg", ".tiff":

            ir := gui.NewQImageReader3(FilePath, f)
            img := ir.Read2()
            pix := gui.QPixmap.ConvertFromImage(img,0)

            scene.AddPixmap(pix)
            view.SetScene(scene)
            view.Show()

        default:
            scene.Clear()
            view.SetScene(scene)
            view.Show()
        }

    }

@therecipe
Copy link
Owner

I will look into this.

@therecipe
Copy link
Owner

Okay, these should work now.

    var (
        ir  = gui.NewQImageReader3(FilePath, "tiff")
        img = gui.NewQImage()
        pix = gui.NewQPixmap()
    )
    ir.Read2(img)
    pix.ConvertFromImage(img, 0)
    var (
        ir  = gui.NewQImageReader3(FilePath, "tiff")
        img = ir.Read()
        pix = gui.QPixmap_FromImage(img, 0)
    )

@5k3105
Copy link
Contributor Author

5k3105 commented Apr 18, 2016

    λ qtdeploy


    build
    output:# local/qt_test
    .\test1.go:80: FsModel.SetRootPath undefined (type *widgets.QFileSystemModel has no field or method SetRootPath)
    .\test1.go:84: FsTreeView.SetRootIndex undefined (type *widgets.QTreeView has no field or method SetRootIndex)
    .\test1.go:84: FsModel.Index2 undefined (type *widgets.QFileSystemModel has no field or method Index2)
    .\test1.go:89: FsTreeView.ConnectCurrentChanged undefined (type *widgets.QTreeView has no field or method ConnectCurrentChanged)

    error:exit status 2

@therecipe
Copy link
Owner

I pushed the changes 100b067
It should work now :)

@5k3105
Copy link
Contributor Author

5k3105 commented Apr 18, 2016

:) Thanks

@5k3105
Copy link
Contributor Author

5k3105 commented Apr 18, 2016

tiff is working! QTableWidget working! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants